PDA

View Full Version : How to receive gesture events on a QGraphicsItem?



tarantulae
16th September 2013, 22:51
I asked this same question on Stackoverflow and also on the Qt forums but nobody answers. I'm facing some problems with gesture events on the QGraphicsItem objects.

I already set:


graphicsView->setAttribute(Qt::WA_AcceptTouchEvents);
graphicsView->viewport()->setAttribute(Qt::WA_AcceptTouchEvents);
graphicsView->grabGesture(Qt::PinchGesture);
graphicsView->viewport()->grabGesture(Qt::PinchGesture);

And I’m still unable to receive gestures on the sceneEvent method of a QGraphicsItem using Qt 5.1, does anyone knows why ?

The Qt 5.1 documentation says:

"When the user performs a gesture, QGestureEvent events will be delivered to the target object, and these can be handled by reimplementing the QWidget::event() handler function for widgets or QGraphicsItem::sceneEvent() for graphics objects."

I'm implementing the QGraphicsItem::sceneEvent() and I'm receiving TouchBegin/TouchEnd/TouchUpdate events, but I never receive gesture events. It is weird that the QGraphicsItem doesn't have the method grabGesture() but the QGraphicsObject has this method.

Thanks !

wysota
18th September 2013, 17:09
Does your screen device support multitouch?