Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct


    Qt World Summit: Early-Bird Tickets

    Macbook trackpad & singer finger events

    General and Desktop
    2
    4
    1915
    Loading More Posts
    • 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.
    • I
      ixSci last edited by

      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!

      1 Reply Last reply Reply Quote 0
      • T
        tucnak last edited by

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

        1 Reply Last reply Reply Quote 0
        • I
          ixSci last edited by

          @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.

          1 Reply Last reply Reply Quote 0
          • I
            ixSci last edited by

            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?

            1 Reply Last reply Reply Quote 0
            • First post
              Last post