Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. International
  3. India
  4. Qt::TapGesture Gesture is not working properly
Forum Updated to NodeBB v4.3 + New Features

Qt::TapGesture Gesture is not working properly

Scheduled Pinned Locked Moved India
1 Posts 1 Posters 1.3k 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.
  • A Offline
    A Offline
    Akhil. V . S
    wrote on last edited by
    #1

    I have created a custom gesture as,
    @
    Gesture*
    CustomTapGestures::create(QObject* pTarget)
    {
    QGesture *Gesture = new QTapGesture(pTarget);
    return Gesture;
    }

    QGestureRecognizer::Result
    CustomTapGestures::recognize(QGesture* Gesture, QObject *Object, QEvent *event)
    {
    QGestureRecognizer::Result result = QGestureRecognizer::Ignore;

    return result;
    }

    void
    CustomTapGestures::reset(QGesture *Gesture)
    {
    Gesture->setProperty("startPoint", QVariant(QVariant::Invalid));
    parent::reset(Gesture);
    }@

    and I am using that in my event class as

    @Screen::Screen(Desktop *Dk)
    {
    QVBoxLayout screenLayout = new QVBoxLayout ;
    screenLayout->addWidget(Dk);
    setLayout(screenLayout);
    QGestureRecognizer
    CTap = new CustomTapGestures ;
    Qt::GestureType CTapId = QGestureRecognizer::registerRecognizer(CTap) ; ;

    grabGesture(CTapId); 
    

    }

    bool Screen::event(QEvent event)
    {
    event->accept();
    if (event->type() == QEvent::Gesture)
    return gestureEvent(static_cast<QGestureEvent
    >(event));
    return QWidget::event(event);
    }

    bool Screen::gestureEvent(QGestureEvent *event)
    {
    if (QGesture *tap = event->gesture(Qt::TapGesture))
    ontapTriggered(static_cast<QTapGesture *>(tap));
    return true;
    }

    void Screen::ontapTriggered(QTapGesture *gesture)
    {
    if( gesture->state() == Qt::GestureFinished )
    qDebug() << "working QTapGesture" ;
    }
    @
    Here Desktop *Dk is a normal widget having size 1280x640, and when tap on screen it is giving output as working tapgesture even if in my tap recognize am disabled it whatever be the event.. ( i am testing this because for a certain condition I want to disable the tap) please give me a solution Thanks in advace

    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