[Qt-interest] QGesture status in 4.6.3?

Oliver.Knoll at comit.ch Oliver.Knoll at comit.ch
Mon Jan 10 11:08:10 CET 2011


On 2011-01-08 Harri Harri Pasanen wrote:

> I wonder if QGesture support is solid in 4.6.3, built in to C7 phone for instance?

I am also currently looking into Gestures, and either I am doing something stupidly wrong, or the functionality is simply not yet as "stable" as one would wish.

So even though my post does not really answer your questions it is more meant to share some experience.

First off, I am using Qt 4.7.1 on Mac OS X 10.6.5 (.6 by now), Cocoa build. 

Based on QGraphicsScene/View I made the following observations:

*
With QGraphicsPixmapItems in the scene, when handling the Gesture within the QGraphicsScene (derived class thereof) I receive proper QGestureEvents (Pan, Pinch) - but only as long as the mouse is not placed over any of my QGraphicsPixmapItems: it seems that the Pan gesture is "swallowed" once the mouse cursor is placed over the item: I do get the "Begin" state of the Pan Gesture, but no events thereafter.

I tried all kind of combinations I could think off, like explicitly turn on/off touch events in the items, in the view, in the scene...

Note that the Pinch Gesture ("zoom in/out") works in any case.

I opened a Qt issue with example code which reproduces this behaviour: http://bugreports.qt.nokia.com/browse/QTBUG-16281


*
Next I did not get QGraphicsObject based items to receive Gesture events (again on Mac OS X): I followed all the advices on e.g. http://www.qtcentre.org/threads/31582-Gestures-and-QGraphicsScene

Namely:

- My QGraphicsView also grabs the Gestures in question
- in my QGraphicsObject subclasss I grab the same Gestures
- in my QGraphicsObject subclass I do call setAcceptTouchEvents(true)
- my boundingRect() method returns some ridiculous large rectangle (for testing)
- I do get the QEvent::TouchBegin and I accept this event as suggested, but...
- I still never get the desired QEvent::Gesture in QGraphicsObject#sceneEvent(QEvent *) method

However, in that very discussion on Qt Centre "stretchtiberius" states that his example is also working with Qt 4.7.1 on Windows 7: he managed to receive QGesture events in QGraphicsObject based items.

I will still have to come up with a small compileable example which demonstrates the issue.


That said I get the impression that the Gesture code still needs some love. And yes, there are some undocumented glitches like *currently* you also have to grab the same QGestures in the QGraphicsView, (the view widget thereof) like in the QGraphicsObject (this will probably be changed in a future release, according to some post, I think somewhere in the Qt issue tracker or on Qt Labs, can't remember).

> A related question: Is there some recommended desktop hardware/OS for testing
> gesture code?   Meego with some netbook?

Again, my platform is Mac OS 10.6.5 on a MacBook Pro (touchpad with Gestures) and Qt 4.7.1 Cocoa build.

Cheers, Oliver
--
Oliver Knoll
Dipl. Informatik-Ing. ETH
COMIT AG - ++41 79 520 95 22





More information about the Qt-interest-old mailing list