96
Flickable to scroll the location vertically.
97
The respective contentHeight gets calculated after the Location is filled with data.
96
ListView for locations with snap-scrolling horizontally.
100
id: locationFlickable
102
height: parent.height
104
// FIXME: not sure where the 3GU comes from, PullToRefresh or something in HomePage?
105
contentHeight: locationPages.currentItem ? locationPages.currentItem.childrenRect.height + units.gu(3) : 0
106
contentWidth: parent.width
108
Behavior on contentHeight {
116
parent: locationFlickable
119
locationPages.loaded = false
121
refreshData(false, true)
126
ListView for locations with snap-scrolling horizontally.
130
objectName: "locationPages"
132
currentIndex: settings.current
133
delegate: LocationPane {}
134
height: childrenRect.height
135
highlightRangeMode: ListView.StrictlyEnforceRange
136
model: weatherApp.locationsList.length
137
orientation: ListView.Horizontal
138
// TODO with snapMode, currentIndex is not properly set and setting currentIndex fails
139
//snapMode: ListView.SnapOneItem
142
property bool loaded: false
144
signal collapseOtherDelegates(int index)
146
onCurrentIndexChanged: {
148
// FIXME: when a model is reloaded this causes the currentIndex to be lost
149
settings.current = currentIndex
151
collapseOtherDelegates(-1) // collapse all
155
currentIndex = settings.current
158
pullToRefresh.refreshing = false
164
if (!visible && loaded) {
165
collapseOtherDelegates(-1) // collapse all
169
// TODO: workaround for not being able to use snapMode property
170
Component.onCompleted: {
171
var scaleFactor = units.gridUnit * 10;
172
maximumFlickVelocity = maximumFlickVelocity * scaleFactor;
173
flickDeceleration = flickDeceleration * scaleFactor;
179
locationPages.currentIndex = settings.current
100
objectName: "locationPages"
102
contentHeight: parent.height
103
currentIndex: settings.current
104
delegate: LocationPane {}
105
highlightRangeMode: ListView.StrictlyEnforceRange
106
model: weatherApp.locationsList.length
107
orientation: ListView.Horizontal
108
// TODO with snapMode, currentIndex is not properly set and setting currentIndex fails
109
//snapMode: ListView.SnapOneItem
111
property bool loaded: false
113
signal collapseOtherDelegates(int index)
115
onCurrentIndexChanged: {
117
// FIXME: when a model is reloaded this causes the currentIndex to be lost
118
settings.current = currentIndex
120
collapseOtherDelegates(-1) // collapse all
124
currentIndex = settings.current
132
if (!visible && loaded) {
133
collapseOtherDelegates(-1) // collapse all
137
// TODO: workaround for not being able to use snapMode property
138
Component.onCompleted: {
139
var scaleFactor = units.gridUnit * 10;
140
maximumFlickVelocity = maximumFlickVelocity * scaleFactor;
141
flickDeceleration = flickDeceleration * scaleFactor;
147
locationPages.currentIndex = settings.current