-
Notifications
You must be signed in to change notification settings - Fork 0
/
WeatherDaySelector.qml
84 lines (66 loc) · 1.99 KB
/
WeatherDaySelector.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
import QtQuick 2.0
import QtQuick.Controls 2.15
import QtQuick.Layouts 1.15
ColumnLayout {
id: column
property var dailyWeatherIconUrlList;
property int currentIndex: 0;
MouseArea {
id: closeArea
width: 10; height: 498
Layout.fillHeight: true
Layout.fillWidth: true
visible: false
onClicked: {
setStateToHidden()
}
}
onStateChanged: {
if (state == "showed")
closeArea.visible = true
else
closeArea.visible = false
}
Component.onCompleted: state = "hidden"
Flickable {
Layout.fillWidth: true
height: 128
contentWidth: 928; contentHeight: 128
flickableDirection: Flickable.HorizontalFlick
RowLayout {
anchors.fill: parent
Repeater {
id: weatherDayWidgetsRepeater
model: 7
property int index;
WeatherDayWidget {
dayOfWeek: dateTime.getFollowingDaysInWeekFromToday()[index]
isCurrentDay: index == 0
weatherIconUrl: dailyWeatherIconUrlList[index]
dayIndex: index
}
}
}
}
function setStateToHidden() {
weatherDaySelector.state = "hidden"
selectDayButton.state = "showed"
}
function unhighlightAllWeatherDayWidgets() {
for (let i = 0; i < 7; i++)
weatherDayWidgetsRepeater.itemAt(i).isCurrentDay = false;
}
states: [
State {
name: "showed"; when: selectDayButton.clicked
PropertyChanges { target: weatherDaySelector; anchors.bottomMargin: 9 }
},
State {
name: "hidden";
PropertyChanges { target: weatherDaySelector; anchors.bottomMargin: -128 }
}
]
transitions: Transition {
NumberAnimation { properties: "anchors.bottomMargin"; duration: 500; easing.type: Easing.InOutQuad }
}
}