File tree Expand file tree Collapse file tree 7 files changed +115
-0
lines changed Expand file tree Collapse file tree 7 files changed +115
-0
lines changed Original file line number Diff line number Diff line change
1
+ # -------------------------------------------------
2
+ #
3
+ # Copyright (C) 2003-2103 CamelSoft Corporation
4
+ #
5
+ # -------------------------------------------------
6
+
7
+ QT += qml quick
8
+
9
+ CONFIG += c++11
10
+
11
+ SOURCES += main.cpp
12
+
13
+ RESOURCES += qml.qrc
Original file line number Diff line number Diff line change
1
+ /* !
2
+ *@file main.cpp
3
+ *@brief 程序主文件
4
+ *@version 1.0
5
+ *@section LICENSE Copyright (C) 2003-2103 CamelSoft Corporation
6
+ *@author zhengtianzuo
7
+ */
8
+ #include < QGuiApplication>
9
+ #include < QQmlApplicationEngine>
10
+
11
+ int main (int argc, char *argv[])
12
+ {
13
+ QCoreApplication::setAttribute (Qt::AA_EnableHighDpiScaling);
14
+ QGuiApplication app (argc, argv);
15
+
16
+ QQmlApplicationEngine engine;
17
+ engine.load (QUrl (QLatin1String (" qrc:/main.qml" )));
18
+
19
+ return app.exec ();
20
+ }
Original file line number Diff line number Diff line change
1
+ /*!
2
+ *@file main.qml
3
+ *@brief 主文件
4
+ *@version 1.0
5
+ *@section LICENSE Copyright (C) 2003-2103 CamelSoft Corporation
6
+ *@author zhengtianzuo
7
+ */
8
+ import QtQuick 2.7
9
+ import QtQuick.Controls 1.4
10
+ import QtQuick.Controls.Styles 1.4
11
+ import QtQuick.Layouts 1.3
12
+
13
+ ApplicationWindow {
14
+ visible: true
15
+ width: 400
16
+ height: 300
17
+ title: qsTr (" Qml日历" )
18
+
19
+ function dayValid (date ){
20
+ var myArray = new Array ();
21
+ myArray[0 ]= " 13" ;
22
+ myArray[1 ]= " 17" ;
23
+ myArray[2 ]= " 26" ;
24
+
25
+ for (var i = 0 ; i < myArray .length ;i++ )
26
+ {
27
+ if (myArray[i] === date)
28
+ {
29
+ return (false );
30
+ }
31
+ }
32
+ return (true );
33
+ }
34
+
35
+ Calendar {
36
+ anchors .centerIn : parent
37
+
38
+ style: CalendarStyle {
39
+ gridVisible: false
40
+ dayDelegate: Rectangle {
41
+ property bool dayIsValid: dayValid (styleData .date .getDate ().toString ())
42
+
43
+ gradient: Gradient {
44
+ GradientStop {
45
+ position: 0.00
46
+ color: styleData .selected && dayIsValid ? " #148014" : (styleData .visibleMonth && styleData .valid ? (dayIsValid ? " #CCCCCC" : " #FFFFFF" ) : " #FFFFFF" );
47
+ }
48
+ }
49
+
50
+ Label {
51
+ text: styleData .date .getDate ()
52
+ anchors .centerIn : parent
53
+ }
54
+
55
+ Rectangle {
56
+ width: parent .width
57
+ height: 1
58
+ color: " #EEEEEE"
59
+ anchors .bottom : parent .bottom
60
+ }
61
+
62
+ Rectangle {
63
+ width: 1
64
+ height: parent .height
65
+ color: " #EEEEEE"
66
+ anchors .right : parent .right
67
+ }
68
+ }
69
+ }
70
+ }
71
+ }
Original file line number Diff line number Diff line change
1
+ <RCC>
2
+ <qresource prefix="/">
3
+ <file>main.qml</file>
4
+ </qresource>
5
+ </RCC>
Original file line number Diff line number Diff line change @@ -32,3 +32,4 @@ SUBDIRS += QmlFlipImage
32
32
SUBDIRS += QmlGrayImage
33
33
SUBDIRS += QmlProgress
34
34
SUBDIRS += QmlWinExtras
35
+ SUBDIRS += QmlCalendar
Original file line number Diff line number Diff line change @@ -142,3 +142,8 @@ QmlWinExtras: QmlWinExtras
142
142
143
143
![ ] ( https://github.com/zhengtianzuo/QtQuickExamples/blob/master/QmlWinExtras/show.gif?raw=true )
144
144
145
+
146
+ QmlCalendar: Qml 日历
147
+
148
+ ![ ] ( https://github.com/zhengtianzuo/QtQuickExamples/blob/master/QmlCalendar/show.gif?raw=true )
149
+
You can’t perform that action at this time.
0 commit comments