on xenial help sign in
move listView property into priv object
fd6dcb0Michael Zanetti
Launcher/LauncherDelegate.qml+12−13
@@ -36,8 +36,6 @@ Item {
36
36
37 property bool dragging:false
37 property bool dragging:false
38
38
39− readonly property ListView listView: ListView.view
40−
41 signal clicked()
39 signal clicked()
42 signal longtap()
40 signal longtap()
43 signal released()
41 signal released()
@@ -155,6 +153,7 @@ Item {
155 QtObject {
153 QtObject {
156 id: priv
154 id: priv
157
155
156+ property ListView listView: root.ListView.view
158 property real totalUnfoldedHeight: listView.itemSize + listView.spacing
157 property real totalUnfoldedHeight: listView.itemSize + listView.spacing
159 property real totalEffectiveHeight: effectiveHeight + listView.spacing
158 property real totalEffectiveHeight: effectiveHeight + listView.spacing
160 property real effectiveContentY: listView.contentY - listView.originY
159 property real effectiveContentY: listView.contentY - listView.originY
@@ -177,7 +176,7 @@ Item {
177 // This is the offset that keeps the items inside the panel
176 // This is the offset that keeps the items inside the panel
178 offset: {
177 offset: {
179 // First/last items are special
178 // First/last items are special
180− if (index == 0 || index == listView.count-1) {
179+ if (index == 0 || index == priv.listView.count-1) {
181 // Just keep them bound to the edges in case they're outside of the visible area
180 // Just keep them bound to the edges in case they're outside of the visible area
182 if (priv.distanceFromEdge < 0) {
181 if (priv.distanceFromEdge < 0) {
183 return (-priv.distanceFromEdge - (height - effectiveHeight)) * priv.orientationFlag;
182 return (-priv.distanceFromEdge - (height - effectiveHeight)) * priv.orientationFlag;
@@ -200,10 +199,10 @@ Item {
200 // The angle used for rotating
199 // The angle used for rotating
201 angle: {
200 angle: {
202 // First/last items are special
201 // First/last items are special
203− if (index == 0 || index == listView.count-1) {
202+ if (index == 0 || index == priv.listView.count-1) {
204 if (priv.distanceFromEdge < 0) {
203 if (priv.distanceFromEdge < 0) {
205 // proportion equation: distanceFromTopEdge : angle = totalUnfoldedHeight/2 : maxAngle
204 // proportion equation: distanceFromTopEdge : angle = totalUnfoldedHeight/2 : maxAngle
206− return Math.max(-maxAngle, priv.distanceFromEdge * maxAngle / (listView.foldingAreaHeight)) * priv.orientationFlag
205+ return Math.max(-maxAngle, priv.distanceFromEdge * maxAngle / (priv.listView.foldingAreaHeight)) * priv.orientationFlag
207 }
206 }
208 return 0; // Don't fold first/last item as long as inside the view
207 return 0; // Don't fold first/last item as long as inside the view
209 }
208 }
@@ -211,23 +210,23 @@ Item {
211 // Are we in the already completely outside the flickable? Fold for the last 5 degrees
210 // Are we in the already completely outside the flickable? Fold for the last 5 degrees
212 if (priv.distanceFromEdge < 0) {
211 if (priv.distanceFromEdge < 0) {
213 // proportion equation: -distanceFromTopEdge : angle = totalUnfoldedHeight : 5
212 // proportion equation: -distanceFromTopEdge : angle = totalUnfoldedHeight : 5
214− return Math.max(-maxAngle, (priv.distanceFromEdge * 5 / listView.foldingAreaHeight) - (maxAngle-5)) * priv.orientationFlag
213+ return Math.max(-maxAngle, (priv.distanceFromEdge * 5 / priv.listView.foldingAreaHeight) - (maxAngle-5)) * priv.orientationFlag
215 }
214 }
216
215
217 // We are overlapping with the folding area, fold the icon to maxAngle - 5 degrees
216 // We are overlapping with the folding area, fold the icon to maxAngle - 5 degrees
218 if (priv.overlapWithFoldingArea > 0) {
217 if (priv.overlapWithFoldingArea > 0) {
219 // proportion equation: overlap: totalHeight = angle : (maxAngle - 5)
218 // proportion equation: overlap: totalHeight = angle : (maxAngle - 5)
220− return -priv.overlapWithFoldingArea * (maxAngle -5) / listView.foldingAreaHeight * priv.orientationFlag;
219+ return -priv.overlapWithFoldingArea * (maxAngle -5) / priv.listView.foldingAreaHeight * priv.orientationFlag;
221 }
220 }
222 return 0;
221 return 0;
223 }
222 }
224
223
225 itemOpacity: {
224 itemOpacity: {
226 // First/last items are special
225 // First/last items are special
227− if (index == 0 || index == listView.count-1) {
226+ if (index == 0 || index == priv.listView.count-1) {
228 if (priv.distanceFromEdge < 0) {
227 if (priv.distanceFromEdge < 0) {
229 // Fade from 1 to 0 in the distance of 3 * foldingAreaHeight (which is when the next item reaches the edge)
228 // Fade from 1 to 0 in the distance of 3 * foldingAreaHeight (which is when the next item reaches the edge)
230− return 1.0 - (-priv.distanceFromEdge / (listView.foldingAreaHeight * 3))
229+ return 1.0 - (-priv.distanceFromEdge / (priv.listView.foldingAreaHeight * 3))
231 }
230 }
232 return 1; // Don't make first/last item transparent as long as inside the view
231 return 1; // Don't make first/last item transparent as long as inside the view
233 }
232 }
@@ -241,16 +240,16 @@ Item {
241 // We are overlapping with the folding area, fade out to 0.75
240 // We are overlapping with the folding area, fade out to 0.75
242 if (priv.overlapWithFoldingArea > 0) {
241 if (priv.overlapWithFoldingArea > 0) {
243 // proportion equation: overlap : totalHeight = 1-opacity : 0.25
242 // proportion equation: overlap : totalHeight = 1-opacity : 0.25
244− return 1 - (priv.overlapWithFoldingArea * 0.25 / listView.foldingAreaHeight)
243+ return 1 - (priv.overlapWithFoldingArea * 0.25 / priv.listView.foldingAreaHeight)
245 }
244 }
246 return 1;
245 return 1;
247 }
246 }
248
247
249 brightness: {
248 brightness: {
250 // First/last items are special
249 // First/last items are special
251− if (index == 0 || index == listView.count-1) {
250+ if (index == 0 || index == priv.listView.count-1) {
252 if (priv.distanceFromEdge < 0) {
251 if (priv.distanceFromEdge < 0) {
253− return -(-priv.distanceFromEdge / (listView.foldingAreaHeight * 3))
252+ return -(-priv.distanceFromEdge / (priv.listView.foldingAreaHeight * 3))
254 }
253 }
255 return 0;
254 return 0;
256 }
255 }
@@ -261,7 +260,7 @@ Item {
261
260
262 // We are overlapping with the folding area, fade out to 0.7
261 // We are overlapping with the folding area, fade out to 0.7
263 if (priv.overlapWithFoldingArea > 0) {
262 if (priv.overlapWithFoldingArea > 0) {
264− return - (priv.overlapWithFoldingArea * 0.3 / listView.foldingAreaHeight)
263+ return - (priv.overlapWithFoldingArea * 0.3 / priv.listView.foldingAreaHeight)
265 }
264 }
266 return 0;
265 return 0;
267 }
266 }