Custom Gestures [RESOLVED]
-
I have some trouble with QGestureRecognizer, i tried to simplfy my problem here is the samplke code ;
GestureWatcher is a derived class from QGestureRecognizer.
@
QGestureRecognizer::Result GestureWatcher::recognize(QGesture *state, QObject *, QEvent *event)
{
if (event->type() == QEvent::GraphicsSceneMousePress) {
return QGestureRecognizer::TriggerGesture;
}
else if (event->type() == QEvent::GraphicsSceneMouseRelease) {
return QGestureRecognizer::FinishGesture;
}
return QGestureRecognizer::Ignore;
}...
// Register custom gesture recognizer.
m_gestureType = QGestureRecognizer::registerRecognizer(new GestureWatcher());
grabGesture(m_gestureType);
...bool GestureItem::sceneEvent(QEvent *event)
{
qDebug() << "event.type" << event->type();
if (event->type() == QEvent::Gesture) {
qDebug() << "This is a gesture !!!!";
return true;
}
return QDeclarativeItem::sceneEvent(event);
}
@Gesture is never catch by sceneEvent i'm getting an error as;
"QGestureManager::deliverEvent: could not find the target for gesture"
. Do you have any idea what i'm missing. Thanks.
-
Hey there,
I found a missing information in documents. You need to set for QGO derived objects hot spot point, otherwise gesture never catch by sceneEvents.