Controlling Flickable with 2 fingers
-
Hi all,
is there a way I can tell the Flickable QML component to be scrolled/flicked by two or more fingers? If not natively, how could one achieve this?
Best!
@DuBu I have never attempted what you describe, but it seems like a good feature. I am intrigued.
Maybe you can simply constrain the existing scroll feature to only operate when two touchpoints are active? This seems risky though. I feel that if I were to attempt this I would probably create a bad user experience.
Apparently this is also called "two finger panning" (in case that helps your searching).
Ahhhhhhh....
OK. Based on my own further searching (due to insatiable curiosity)...
It seems that if the operating system (OS) is configured properly, then (in some cases?) Qt will make this "just work", but in the GUI app you will not necessarily know that a two-finger scroll (or two-finger pan gesture) is happening. It will have been translated into some other mouse action. That's at least the rough idea I get from looking at this: https://stackoverflow.com/questions/70037430/qt-how-to-implement-panning-zooming-in-qgraphicsscene-with-two-finger-gestures
Just in case, you might want to look at the multitouch examples:
▶ https://github.com/qt/qtdeclarative/blob/dev/examples/quick/pointerhandlers/multiflame.qml
(Qt5 had one called "bearwhack" which seems removed in qt6, perhaps for reasons of cruelty-to-cartoon-animals ?) https://github.com/qt/qtdeclarative/tree/5.15/examples/quick/touchinteraction/multipointtouch
▶ https://doc.qt.io/qt-6/qtquick-touchinteraction-example.html
There seems to be a QML Gesture (https://doc.qt.io/qt-6/qml-qtquick-gestureevent.html), but at least in the online doc it doesn't appear to have nearly the number of members that (non-qml) QGestureEvent has: https://doc.qt.io/qt-6/qgestureevent.html
-
@DuBu I have never attempted what you describe, but it seems like a good feature. I am intrigued.
Maybe you can simply constrain the existing scroll feature to only operate when two touchpoints are active? This seems risky though. I feel that if I were to attempt this I would probably create a bad user experience.
Apparently this is also called "two finger panning" (in case that helps your searching).
Ahhhhhhh....
OK. Based on my own further searching (due to insatiable curiosity)...
It seems that if the operating system (OS) is configured properly, then (in some cases?) Qt will make this "just work", but in the GUI app you will not necessarily know that a two-finger scroll (or two-finger pan gesture) is happening. It will have been translated into some other mouse action. That's at least the rough idea I get from looking at this: https://stackoverflow.com/questions/70037430/qt-how-to-implement-panning-zooming-in-qgraphicsscene-with-two-finger-gestures
Just in case, you might want to look at the multitouch examples:
▶ https://github.com/qt/qtdeclarative/blob/dev/examples/quick/pointerhandlers/multiflame.qml
(Qt5 had one called "bearwhack" which seems removed in qt6, perhaps for reasons of cruelty-to-cartoon-animals ?) https://github.com/qt/qtdeclarative/tree/5.15/examples/quick/touchinteraction/multipointtouch
▶ https://doc.qt.io/qt-6/qtquick-touchinteraction-example.html
There seems to be a QML Gesture (https://doc.qt.io/qt-6/qml-qtquick-gestureevent.html), but at least in the online doc it doesn't appear to have nearly the number of members that (non-qml) QGestureEvent has: https://doc.qt.io/qt-6/qgestureevent.html
@KH-219Design Hi, thanks for your effort to answer my question. I'll have a look at your links.
Regarding the bad user experience: I also don't like to scroll with only two fingers much, but I need the one finger gesture to move something on top of the flickable without scrolling the flickable at the same time. -
@KH-219Design Hi, thanks for your effort to answer my question. I'll have a look at your links.
Regarding the bad user experience: I also don't like to scroll with only two fingers much, but I need the one finger gesture to move something on top of the flickable without scrolling the flickable at the same time.@DuBu I'll be curious to know what kind of fix you might devise in the end.
To clarify my "bad user experience" remark: I did not actually intend to disparage the general idea of two-finger scroll. I was saying that if I tried to implement it myself from scratch I feel like I would easily implement it poorly. The more I think about what the touchpad driver would even be doing to distinguish two fingers scrolling from two fingers rotating or pinching, it makes my head hurt.