[Qt-interest] QGraphicsScene and multitouch events
Oliver.Knoll at comit.ch
Oliver.Knoll at comit.ch
Wed Jan 5 15:12:23 CET 2011
Hi Sean,
On 2011-01-04 Sean Sean Hayes wrote:
> To get gestures to work in a QGraphicsView (in the scene) you have to
> do the following:
> ...
> You can also check out this forum post.
> http://www.qtcentre.org/threads/31582-
> Gestures-and-QGraphicsScene?p=172577.
I am exactly in the same situation, but I also could not get gestures to work in QGraphicObject based items! I followed all the steps (thanks for the qtcentre post! Was a great help ;), I do get the touch begin event inside my QGraphicsObject based instance, but no gesture events!
If however I handle the gesture events inside the QGraphicsScene instance that works. Unfortunately then I hit another bug: http://bugreports.qt.nokia.com/browse/QTBUG-16281: "Pan Gesture swallowed in QGraphicsView when mouse over item". I was hoping I could work around that bug by adding an "invisible"(1) QGraphicsObject which would handle the gesture events instead, e.g. as parent for each QGraphicsPixmap item I have in my scene.
(1) Note that I did explicitly /not/ set setVisible(false), because I understand the item would then receive no events at all (http://doc.qt.nokia.com/4.7//qgraphicsitem.html#setVisible) - instead I set the flag QGraphicsItem::ItemHasNoContents (but off course I also tried without this flag, as well as all wird combinations accepting/ignoring/grabbing touch events in the scene/view/other items).
I will yet have to come up with a simple example and file a bug report accordingly. I must admit I experimented with my existing code, so chances are I did something else wrong, but your explanations seemed to be simple enough as not to make any mistake.
I am on Qt 4.7.1 on a MacBook Pro with Mac OS 10.6.5 - again Gestures work when handled on a Scene level, so Gestures are definitively supported on my platform - it is just the QGraphicsObject which does not seem to receive them!
Cheers, Oliver
--
Oliver Knoll
Dipl. Informatik-Ing. ETH
COMIT AG - ++41 79 520 95 22
More information about the Qt-interest-old
mailing list