Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-40088

QTabletEvent pointerType not properly detected

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P4: Low
    • None
    • 5.3.1
    • None
    • Qt 5.3.1, VS2013 x64, Windows 8.1 x64, Duo Sense Pen 2 (same stylus as Surface Pro 3)

    Description

      When the eraser mode of the pen is used, it is not properly reported as QTabletEvent::Eraser when querying pointerType().
      More precisely, it is only properly reported 20% on the time, seems random.

      Workaround:
      implement nativeEvent in your widget to retrieve the pen id:

      bool MyWidget::nativeEvent(const QByteArray &eventType, void *message, long *result)
      {
      #if defined(Q_OS_WIN32)
          if(eventType=="windows_generic_MSG")
          {
              MSG* msg=(MSG*)message;
              switch (msg->message)
              {
              case WM_POINTERENTER:
                  penId=GET_POINTERID_WPARAM(msg->wParam);
                  break;
              }
          }
          return false;
      #endif
      }
      

      then in tabletEvent, you can get the real pointer type this way:

      void MyWidget::tabletEvent(QTabletEvent *event)
      {
      #if defined(Q_OS_WIN32)
          POINTER_PEN_INFO penInfo;
          GetPointerPenInfo(penId,&penInfo);
          if(penInfo.penFlags&&PEN_FLAG_INVERTED || penInfo.penFlags&&PEN_FLAG_ERASER)
          {
              //eraser
          }
      #endif
      }
      

      Attachments

        1. qtbug40088_pointer.diff
          2 kB
          Friedemann Kleint

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              srutledg Shawn Rutledge
              divide Robin Lobel
              Votes:
              1 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes