[Qt-interest] cannot grab gesture with qgraphicsobject

Wathek LOUED wathek at gmail.com
Mon Mar 7 19:31:18 CET 2011


Hi,

I got a problem with QGraphicsObject, I cannot grab gesture and I'm getting
this message : QGestureManager::deliverEvent: could not find the target for
gesture.

I put in the constructor :

setAcceptTouchEvents(true);
tapGestureRecognizer = new TapGestureRecognizer();
tapGesture = QGestureRecognizer::registerRecognizer(tapGestureRecognizer);
grabGesture(tapGesture);


and I reimplemented the bool QGraphicsItem::sceneEvent(QEvent *) function :

bool PushButtonItem::sceneEvent(QEvent *event)
{
qDebug("Event received");
if (event->type() == QEvent::Gesture)
gestureEvent(static_cast<QGestureEvent *>(event));

        return true;
}

void PushButtonItem::gestureEvent(QGestureEvent *event)
{
if (event->gesture(tapGesture))
qDebug("button Tapped");
}


the same code works well when I use it with the viewport of my QGraphicsView
but it doesn't work with QGraphicsObject. Any idea ?

Thank you so much

Wathek
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110307/0092e83c/attachment.html 


More information about the Qt-interest-old mailing list