Qt Touch and Gesture related questions.
I'm relatively new to Qt, been working in the touch domain for a few months and just picked up Qt as a possible application framework for multi-touch based applications. The first thing I noticed which caused me some grief is that when running the PinchZoom example code from within QtCreator through what I believe is called the simulator, the zooming / pinch would not work. However everything works fine when I run it through the terminal after a "make" and "./pinchzoom". What is happening here that causes these touch events to be treated differently in these two different environments? It simply doesn't seem to create the correct events in the simulator.
The second curiosity I noticed was that Qt has a gesture recognizer which can be subscribed to using the grabGesture(Qt::PinchGesture); syntax. Odd that there is a gesture recognizer but it is not used for the pinchzoom example. So I attempted to make use of it for my own pinchzoom application which incorporates a subclassed QGraphicsView with a jpg in the scene allowing the user to scroll around the image (its larger than the GraphicsView) and to zoom in or out using a two finger pinch gesture.
So I set up to listen to 3 gestures:
and then caught them and printed some information to see exactly when they were triggered
if (QGesture *swipe = event->gesture(Qt::SwipeGesture))
qDebug() << "Swipe gesture detected";
else if (QGesture *pan = event->gesture(Qt::PanGesture))
qDebug() << pan gesture detected";
if (QGesture *pinch = event->gesture(Qt::PinchGesture))
qDebug() << pinch gesture detected";
Running this, I noticed a few things. Firstly I could never seem to trigger a swipe gesture. The "swipe gesture" must be something different to that in my mental model. The other oddity was that a PanGesture was some sort of two finger gesture that was triggered along with a pinch gesture every time i moved with two touch events. Both of these gestures seemed to be recognized and triggered at the same time. This was somewhat annoying as when performing a pinch i didn't want to be "panning". Im not even sure what "panning" is any more or "swipeing".
So I have a few questions
I am using the sample code from PinchZoom to handle my two finger zooming ability. Should I replace this with a gesture recognizer and attempt to manage both pinch and pan events?
Is a pan essentially "scrolling" as a user can do with the mouse by clicking, holding and moving their mouse around the graphics view? I am implementing this feature by using one finger panning with the following code after catching a recognizing a QEvent as a TouchEvent in the viewPort of my QGraphicsView.
if (touchPoints.count() == 1)
This seems to then be sending the event off somewhere else to be dealt with as a mouse event.
There doesn't seem to be a rotate gestureShould I implement this or is there sample code of a rotate?
What is a Swipe gesture, I couldn't seem to get one recognized.
Hi and welcome to devnet,
I haven't seen many touch/gesture relate posts that went so "low-level", you might want to try asking on the interest mailing list, there you'll find Qt's developers/maintainers (this forum is more user oriented)