[Qt-interest] QGraphicsScene and multitouch events
Sean Hayes
sean.t.hayes at vanderbilt.edu
Fri Jan 7 17:20:12 CET 2011
Sorry for the slow reply. I am currently moving and do not have my computer
setup correctly.
On Thu, Jan 6, 2011 at 3:29 AM, <Oliver.Knoll at comit.ch> wrote:
> On 2011-01-05 Sean Sean Hayes wrote:
>
> > Oliver,
> >
> > I am not sure what the problem could be. Maybe you could include your
> > code or post it to the forum thread.
>
> I saw on that Qt Forum (or was it Qt Centre? ;) posting from you that you
> have working code. But I think you tried successfully with Qt 4.6.x
>
That is correct. Originally, I created it and ran it with Qt 4.6.x
>
> Are you saying that your code from back then is still working (on Windows 7
> or whatever platform you were testing)? That would at least indicate whether
> it is really a platform (Mac) issue or a regression from Qt 4.6 to 4.7.
>
Yes, I have tested it again with Qt 4.7.1 and the code still works running
on Windows 7.
>
> I didn't have time yet to come up with a simple
> QGraphicsScene/QGraphicsObject example which would demonstrate the
> "QGraphicsObject not receiving Gesture events" issue.
>
>
> However, I do have a fully compileable example attached to
> http://bugreports.qt.nokia.com/browse/QTBUG-16281 which shows another
> odity, namely that "Pan Gestures" are "swallowed" by QGraphicsItem (note:
> not QGraphicsObject) when the mouse hovers over them. The QGraphicsScene
> /does/ receive the Gesture in Qt::GestureStarted state, but no
> Qt::GestureUpdated anymore. But only in case of Pan Gestures: In case of
> Pinch Gestures it works, regardless of where the mouse cursor is located in
> the scene (at the time when the Gesture is started).
>
Have you checked to see the the "swallowed" events can be accessed from the
QGraphicsView? You could move your gesture code from the scene to the view
and access the gesture events through the viewportEvent() function.
I believe this receives gestures before the QGraphicsItems or
QGraphicsObjects do. But, that would need to be confirmed.
>
> Pan Gesture also works as expected when the mouse cursor is /not/ located
> over any item. The items themselves are stock QGraphicsPixmapItems, and I
> explicitly do not accept touch events for them (but it does not seem to
> matter, I tried also accepting touch events for the items).
>
> Maybe if you could download and compile (qmake; make) that example (
> http://bugreports.qt.nokia.com/secure/attachment/19372/GraphicsViewGesture.zip)
> and tell me about the outcome on your platform (with Qt 4.7.1 if possible -
> but would also be interesting to test with Qt 4.6.x). Note that the Gestures
> do nothing more than create qDebug output on the console, and in case of Pan
> the cursor is changed. But in my case the cursor keeps its "Pan" cross
> arrow, because no "end" Gesture state is received either.
>
I downloaded the code and ran it with Qt 4.7.1 on Windows 7. I think I have
identified your problem. A QGrestureEvent will contain all the gestures
currently being performed on the widget/view grabbing them. Therefore, you
are actually receiving both QPanGestures and QPinchGesutres simultaneously.
Within your GestureGraphicsScene::gestureEvent(), if you receive a
PanGesture, you do not check for the PinchGesture. That is, you should
remove the else and test both with an if statement.
>
> If you have some spare 5 minutes time, that is ;)
Let me know if that works for you.
Sean
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110107/6f33cf7a/attachment.html
More information about the Qt-interest-old
mailing list