-
Notifications
You must be signed in to change notification settings - Fork 1
/
Page1.qml
133 lines (110 loc) · 4.07 KB
/
Page1.qml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
import QtQuick 2.7
import QtQuick.Controls 2.0
Item {
id: p1
property int hours
property int minutes
property int seconds
property bool night: false
property color background: "gray"
function timeChanged() {
var date = new Date;
hours = date.getHours()
night = ( hours < 7 || hours > 19 )
minutes = date.getMinutes()
seconds = date.getUTCSeconds();
}
Timer {
interval: 100; running: true; repeat: true;
onTriggered: p1.timeChanged()
}
FontLoader { id: robotoThin; source: "FONT/roboto/Roboto-Thin.ttf" }
Rectangle {
anchors.fill: parent
color: Qt.darker(p1.background)
Row {
anchors.fill: parent
Rectangle {
width: parent.width/2
height: parent.height
color: Qt.darker(p1.background)
Rectangle {
id: rectWhite
width: 300
height: 300
anchors.verticalCenter: parent.verticalCenter
x: -width/2
color: Qt.lighter("lightgray")
rotation: 45
Behavior on width {
NumberAnimation { duration: 1000 }
}
Behavior on height {
NumberAnimation { duration: 1000 }
}
Behavior on rotation {
NumberAnimation { duration: 1000 }
}
Behavior on x {
NumberAnimation { duration: 1000 }
}
MouseArea {
anchors.fill: parent
onClicked: {
if (rectWhite.width == 300) {
rectWhite.x= width
rectWhite.width=301
//rectWhite.height=600
//rectWhite.rotation=90
}
else {
rectWhite.x= -width/2
rectWhite.width=300
//rectWhite.height=300
//rectWhite.rotation=45
}
}
}
}
Rectangle {
id: rectTogether
width: 450
height: 425
anchors.right: rectWhite.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
color: Qt.lighter("lightgray")
Image {
anchors.centerIn: parent
source: "IMAGES/marca-oficial.png"
sourceSize: Qt.size(250, 300)
fillMode: Image.PreserveAspectFit
}
}
}
Column {
width: parent.width/2
height: parent.height
Text {
id: labelHour
text: p1.hours+":"+p1.minutes+":"+p1.seconds
color: Qt.lighter("lightgray")
width: parent.width
height: parent.height/2
verticalAlignment: Text.AlignBottom
horizontalAlignment: Text.AlignRight
font { family: robotoThin.name; weight: Font.Thin; pixelSize: 180; }
}
Text {
id: labelDate
text: Qt.formatDateTime(new Date(), "dd/MM/yyyy")
color: Qt.lighter("lightgray")
width: parent.width
height: parent.height/2
verticalAlignment: Text.AlignTop
horizontalAlignment: Text.AlignRight
font { family: robotoThin.name; weight: Font.Light; pixelSize: 80; }
}
}
}
}
}