Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Questions about gestures
Bradzo last edited by
I am trying to get gestures working on a Surface Pro 4.
The background: I have a library of thumbnails images I need to get scrolling on the GUI. The plan is that there is no mouse, just a touch interface.
I used a QScrollArea (which is the size of a widget on the screen). It holds a much larger QFrame (actually my custom class derived from QFrame). I turn the scroll bars off (via SetScrollPolicy). I place the thumbnails into my derived class from QFrame. Every seems good. The Thumbnails are displayed and wheel events scroll the thumb nails around.
I have tried to use a 'Pan' gesture to do scrolling. One reason I am using 'Pan' is it give some distance (or size) of the gesture in the event. 'Swipe' returns a direction, but does not tell you how far the gesture took place.
One problem I am having is: who should grab the gesture events? I seem to be able to grab them in the QScrollArea or the QFrame. The Gesture recognizer fills in the 'hot spot'. I'm not really sure how the 'hot spot' would be calculated.
Also, I can't find an documentation with regard to the delta member function of the gesture event:
This returns a QPointF. I kind of expected pixel values, but the number always seem to be a multiple of 0.5. I don't know what the units are. I somehow need to scroll the thumbnails by pixel values. (What I do is use the distance from the gesture to move the scroll bars (which are never shown) via the setValue function.
The whole point of this question is the gesture seem to come in very erratically and I'm not sure why. There are two 'background' things (the scroll area and the QFrame) and I want one of them to get the gestures and move the scroll area around. I don't want the Thumbnails to get the gesture events. The distance the gesture event contains seems bogus.
Does anybody have any experience with gestures??
Thanks for you help.