Merge lp:~zsombi/ubuntu-ui-toolkit/slider-blocks-flickable into lp:ubuntu-ui-toolkit/staging
- slider-blocks-flickable
- Merge into staging
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | Tim Peeters | ||||
Approved revision: | 1194 | ||||
Merged at revision: | 1198 | ||||
Proposed branch: | lp:~zsombi/ubuntu-ui-toolkit/slider-blocks-flickable | ||||
Merge into: | lp:ubuntu-ui-toolkit/staging | ||||
Diff against target: |
261 lines (+240/-0) 3 files modified
modules/Ubuntu/Components/Slider.qml (+20/-0) tests/resources/sliders/SliderTest.qml (+92/-0) tests/unit_x11/tst_components/tst_slider.qml (+128/-0) |
||||
To merge this branch: | bzr merge lp:~zsombi/ubuntu-ui-toolkit/slider-blocks-flickable | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
PS Jenkins bot | continuous-integration | Needs Fixing | |
Tim Peeters | Approve | ||
Review via email: mp+230438@code.launchpad.net |
Commit message
Slider blocks Flickable while sliding.
Description of the change
Zsombor Egri (zsombi) wrote : | # |
It's not possible. Flickable filters mouse events. And even if it would be possible, it would block the vertical swipes as well, which we don't want to, right?
Tim Peeters (tpeeters) wrote : | # |
Update the (C) year
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1187
http://
Executed test runs:
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1187
http://
Executed test runs:
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
Zsombor Egri (zsombi) wrote : | # |
> Update the (C) year
Which one?
Tim Peeters (tpeeters) wrote : | # |
> > Update the (C) year
>
> Which one?
Slider.qml
Tim Peeters (tpeeters) wrote : | # |
> > Update the (C) year
>
> Which one?
Slider.qml
Zsombor Egri (zsombi) wrote : | # |
> > > Update the (C) year
> >
> > Which one?
>
> Slider.qml
Whu should I update Slider.qml? It has been made 2 years ago...
Tim Peeters (tpeeters) wrote : | # |
If this output is intentional, add some extra info to the print()
75 + onInteractiveCh
if not, remove please
Tim Peeters (tpeeters) wrote : | # |
This MR will make flicking hard when there is a slider in the way.
What happens when you are flicking trough a big list, and then at one point (you keep flicking) you "grab" on a slider to flick more.. Flicking stops and the slider value changes?
Zsombor Egri (zsombi) wrote : | # |
> This MR will make flicking hard when there is a slider in the way.
>
> What happens when you are flicking trough a big list, and then at one point
> (you keep flicking) you "grab" on a slider to flick more.. Flicking stops and
> the slider value changes?
I see two patterns here:
1) when flicking or kinetic scrolling, there should be no component getting the focus/interaction
2) when a slider is touched, it would grab the focus for ~500-800 msecs, then the Flickable behind would take the control; this would give more time for a Slider to handle its events
2.1) however a better gesture handling would be needed here than simple MouseAreas. Like adding a threshold value that specifies what is the interval the other direction is still handled by the component, and after which the gesture is forwarded to the component behind.
- 1192. By Zsombor Egri
-
rogue print removed
Zsombor Egri (zsombi) wrote : | # |
> > This MR will make flicking hard when there is a slider in the way.
> >
> > What happens when you are flicking trough a big list, and then at one point
> > (you keep flicking) you "grab" on a slider to flick more.. Flicking stops
> and
> > the slider value changes?
>
> I see two patterns here:
> 1) when flicking or kinetic scrolling, there should be no component getting
> the focus/interaction
> 2) when a slider is touched, it would grab the focus for ~500-800 msecs, then
> the Flickable behind would take the control; this would give more time for a
> Slider to handle its events
> 2.1) however a better gesture handling would be needed here than simple
> MouseAreas. Like adding a threshold value that specifies what is the interval
> the other direction is still handled by the component, and after which the
> gesture is forwarded to the component behind.
Ok, had a meeting with Giorgio, and this is the preferred way to do it.
Tim Peeters (tpeeters) wrote : | # |
Why did you add a separate directory resources/sliders/? Do you anticipate a lot of files to be added there
61 + property bool trueValue: true
I think this can be removed.
SliderTest.qml and tst_slider.qml have a lot of similar code.
Is there a way that we can simply run tst_slider.qml with qmlscene? Then we don't need to keep SliderTest any more.
Zsombor Egri (zsombi) wrote : | # |
> Why did you add a separate directory resources/sliders/? Do you anticipate a
> lot of files to be added there
No, just that I thought our policy is to have a separate folder for each component, but yeah, it can be straight in tests/resources.
>
> 61 + property bool trueValue: true
> I think this can be removed.
Ah, yes. Good catch!
>
> SliderTest.qml and tst_slider.qml have a lot of similar code.
>
> Is there a way that we can simply run tst_slider.qml with qmlscene? Then we
> don't need to keep SliderTest any more.
I tried but didn't work... I can try once more a bit harder.
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:1191
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:1192
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
Zsombor Egri (zsombi) wrote : | # |
Whoaaah, Jenkins works!!!
- 1193. By Zsombor Egri
-
unneeded property removed
- 1194. By Zsombor Egri
-
staging merge
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1194
http://
Executed test runs:
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
Preview Diff
1 | === modified file 'modules/Ubuntu/Components/Slider.qml' |
2 | --- modules/Ubuntu/Components/Slider.qml 2014-04-23 08:50:20 +0000 |
3 | +++ modules/Ubuntu/Components/Slider.qml 2014-08-20 10:02:27 +0000 |
4 | @@ -140,6 +140,26 @@ |
5 | property real dragInitMouseX: 0.0 |
6 | property real dragInitNormalizedValue: 0.0 |
7 | |
8 | + property Flickable flickable: { |
9 | + // traverse parents to catch whether we have an ancestor Flickable |
10 | + var pl = slider.parent; |
11 | + while (pl) { |
12 | + if (pl.hasOwnProperty("flicking")) { |
13 | + return pl; |
14 | + } |
15 | + pl = pl.parent; |
16 | + } |
17 | + return null; |
18 | + } |
19 | + |
20 | + states: State { |
21 | + name: "sliding" |
22 | + when: mouseArea.flickable && mouseArea.pressed |
23 | + PropertyChanges { |
24 | + target: mouseArea.flickable |
25 | + interactive: false |
26 | + } |
27 | + } |
28 | function normalizedValueFromValue(value) { |
29 | if (Qt.application.layoutDirection == Qt.RightToLeft) { |
30 | return MathUtils.clampAndProject(value, slider.minimumValue, |
31 | |
32 | === added directory 'tests/resources/sliders' |
33 | === added file 'tests/resources/sliders/SliderTest.qml' |
34 | --- tests/resources/sliders/SliderTest.qml 1970-01-01 00:00:00 +0000 |
35 | +++ tests/resources/sliders/SliderTest.qml 2014-08-20 10:02:27 +0000 |
36 | @@ -0,0 +1,92 @@ |
37 | +/* |
38 | + * Copyright 2014 Canonical Ltd. |
39 | + * |
40 | + * This program is free software; you can redistribute it and/or modify |
41 | + * it under the terms of the GNU Lesser General Public License as published by |
42 | + * the Free Software Foundation; version 3. |
43 | + * |
44 | + * This program is distributed in the hope that it will be useful, |
45 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
46 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
47 | + * GNU Lesser General Public License for more details. |
48 | + * |
49 | + * You should have received a copy of the GNU Lesser General Public License |
50 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
51 | + */ |
52 | + |
53 | +import QtQuick 2.0 |
54 | +import Ubuntu.Components 1.1 |
55 | +import Ubuntu.Components.ListItems 1.0 |
56 | + |
57 | +MainView { |
58 | + width: units.gu(50) |
59 | + height: units.gu(100) |
60 | + |
61 | + Column { |
62 | + anchors { |
63 | + fill: parent |
64 | + margins: units.gu(1) |
65 | + } |
66 | + UbuntuListView { |
67 | + id: listView |
68 | + width: parent.width |
69 | + height: units.gu(20) |
70 | + clip: true |
71 | + model: 10 |
72 | + interactive: true |
73 | + delegate: Standard { |
74 | + control: Slider { |
75 | + objectName: "testSlider" + index |
76 | + } |
77 | + } |
78 | + } |
79 | + UbuntuListView { |
80 | + id: listView2 |
81 | + width: parent.width |
82 | + height: units.gu(20) |
83 | + clip: true |
84 | + model: 10 |
85 | + delegate: Slider { |
86 | + objectName: "testSlider" + index |
87 | + } |
88 | + } |
89 | + Flickable { |
90 | + id: flickable |
91 | + width: parent.width |
92 | + height: units.gu(20) |
93 | + clip: true |
94 | + contentHeight: column.height |
95 | + Column { |
96 | + id: column |
97 | + width: parent.width |
98 | + height: childrenRect.height |
99 | + Repeater { |
100 | + model: 10 |
101 | + Standard { |
102 | + control: Slider { |
103 | + objectName: "testSlider" + index |
104 | + } |
105 | + } |
106 | + } |
107 | + } |
108 | + } |
109 | + Flickable { |
110 | + id: flickable2 |
111 | + width: parent.width |
112 | + height: units.gu(20) |
113 | + clip: true |
114 | + contentHeight: column2.height |
115 | + Column { |
116 | + id: column2 |
117 | + width: parent.width |
118 | + height: childrenRect.height |
119 | + Repeater { |
120 | + model: 10 |
121 | + Slider { |
122 | + objectName: "testSlider" + index |
123 | + } |
124 | + } |
125 | + } |
126 | + } |
127 | + } |
128 | +} |
129 | |
130 | === added file 'tests/unit_x11/tst_components/tst_slider.qml' |
131 | --- tests/unit_x11/tst_components/tst_slider.qml 1970-01-01 00:00:00 +0000 |
132 | +++ tests/unit_x11/tst_components/tst_slider.qml 2014-08-20 10:02:27 +0000 |
133 | @@ -0,0 +1,128 @@ |
134 | +/* |
135 | + * Copyright 2014 Canonical Ltd. |
136 | + * |
137 | + * This program is free software; you can redistribute it and/or modify |
138 | + * it under the terms of the GNU Lesser General Public License as published by |
139 | + * the Free Software Foundation; version 3. |
140 | + * |
141 | + * This program is distributed in the hope that it will be useful, |
142 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
143 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
144 | + * GNU Lesser General Public License for more details. |
145 | + * |
146 | + * You should have received a copy of the GNU Lesser General Public License |
147 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
148 | + */ |
149 | + |
150 | +import QtQuick 2.0 |
151 | +import QtTest 1.0 |
152 | +import Ubuntu.Test 1.0 |
153 | +import Ubuntu.Components 1.1 |
154 | +import Ubuntu.Components.ListItems 1.0 |
155 | + |
156 | +MainView { |
157 | + width: units.gu(40) |
158 | + height: units.gu(71) |
159 | + |
160 | + Column { |
161 | + anchors { |
162 | + fill: parent |
163 | + margins: units.gu(1) |
164 | + } |
165 | + UbuntuListView { |
166 | + id: listView |
167 | + width: parent.width |
168 | + height: units.gu(20) |
169 | + clip: true |
170 | + model: 10 |
171 | + delegate: Standard { |
172 | + control: Slider { |
173 | + objectName: "testSlider" + index |
174 | + } |
175 | + } |
176 | + } |
177 | + UbuntuListView { |
178 | + id: listView2 |
179 | + width: parent.width |
180 | + height: units.gu(20) |
181 | + clip: true |
182 | + model: 10 |
183 | + delegate: Slider { |
184 | + objectName: "testSlider" + index |
185 | + } |
186 | + } |
187 | + Flickable { |
188 | + id: flickable |
189 | + width: parent.width |
190 | + height: units.gu(20) |
191 | + clip: true |
192 | + contentHeight: column.height |
193 | + Column { |
194 | + id: column |
195 | + width: parent.width |
196 | + height: childrenRect.height |
197 | + Repeater { |
198 | + model: 10 |
199 | + Standard { |
200 | + control: Slider { |
201 | + objectName: "testSlider" + index |
202 | + } |
203 | + } |
204 | + } |
205 | + } |
206 | + } |
207 | + Flickable { |
208 | + id: flickable2 |
209 | + width: parent.width |
210 | + height: units.gu(20) |
211 | + clip: true |
212 | + contentHeight: column2.height |
213 | + Column { |
214 | + id: column2 |
215 | + width: parent.width |
216 | + height: childrenRect.height |
217 | + Repeater { |
218 | + model: 10 |
219 | + Slider { |
220 | + objectName: "testSlider" + index |
221 | + } |
222 | + } |
223 | + } |
224 | + } |
225 | + } |
226 | + |
227 | + UbuntuTestCase { |
228 | + name: "SliderAPI" |
229 | + when: windowShown |
230 | + |
231 | + SignalSpy { |
232 | + id: flickSpy |
233 | + signalName: "onMovementStarted" |
234 | + } |
235 | + |
236 | + function cleanup() { |
237 | + flickSpy.target = null; |
238 | + flickSpy.clear(); |
239 | + } |
240 | + |
241 | + function test_slider_blocks_flickable_data() { |
242 | + return [ |
243 | + {tag: "ListView with Slider in ListItem", flickable: listView}, |
244 | + {tag: "ListView with Slider alone", flickable: listView2}, |
245 | + {tag: "Flickable with Column of Slider in ListItem", flickable: flickable}, |
246 | + {tag: "Flickable with Column of Slider alone", flickable: flickable2}, |
247 | + ]; |
248 | + } |
249 | + |
250 | + function test_slider_blocks_flickable(data) { |
251 | + flickSpy.target = data.flickable; |
252 | + var slider = findChild(data.flickable, "testSlider1"); |
253 | + verify(slider, "cannot find test slider in " + data.tag); |
254 | + var sliderPos = slider.mapToItem(data.flickable, units.gu(10), 0); |
255 | + mouseDrag(data.flickable, sliderPos.x, sliderPos.y, units.gu(20), units.gu(20)); |
256 | + waitForRendering(data.flickable, 200); |
257 | + compare(flickSpy.count, 0, "The Flickable should not move while Slider is active."); |
258 | + compare(data.flickable.interactive, true, "The Flickable aint got back to interactive mode."); |
259 | + } |
260 | + } |
261 | +} |
This will mess up the flickable settings if for some reason Flickable. interactive must be set to false. When interacting with the slider, it will be reset to true.
Is it not possible to block the events going to the flickable by setting propagateCompos edEvents of the Slider's MouseArea to false?