Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Custom Gestures [RESOLVED]
Forum Updated to NodeBB v4.3 + New Features

Custom Gestures [RESOLVED]

Scheduled Pinned Locked Moved General and Desktop
2 Posts 1 Posters 1.5k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    nightroad
    wrote on last edited by
    #1

    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.

    1 Reply Last reply
    0
    • N Offline
      N Offline
      nightroad
      wrote on last edited by
      #2

      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.

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved