Macbook trackpad & singer finger events



  • Hi there!

    I'm trying to get event when user touch the trackpad with single finger but have no success. I receive events only for 2 more fingers.
    I've set Qt::WA_AcceptTouchEvents and Qt::WA_TouchPadAcceptSingleTouchEvents to the main window.
    What else should I do to start receive those events?

    Thanks!



  • On the words you are doing all in the right way. Can you show snippet of your code?



  • @MainWindow::MainWindow(QWidget *parent)
    {
    ...
    qApp->installEventFilter(this);
    setAttribute(Qt::WA_AcceptTouchEvents);
    setAttribute(Qt::WA_TouchPadAcceptSingleTouchEvents);
    }
    bool MainWindow::eventFilter(QObject *, QEvent * pEvent)
    {
    switch(pEvent->type())
    {
    case QEvent::TouchBegin:
    qDebug("BEGIN!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
    break;
    case QEvent::TouchUpdate:
    qDebug("UPDATE!!!!!!!!!!!!!!!!!!!!!!!!!!");
    break;
    case QEvent::TouchEnd:
    qDebug("END!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
    break;
    };
    return false;
    }@
    It prints nothing for 1 finger.



  • It seems I've found the issue: widgets which are lied on top of my window receive touch events and since they doesn't have Qt::WA_TouchPadAcceptSingleTouchEvents, just ignore it.
    Is there a better solution then just set that flag to all descendants recursively?


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.