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

Windows: Disabling Press&Hold using SetProp for MicrosoftTabletPenServiceProperty breacks touch for QMenu

    XMLWordPrintable

Details

    • Windows

    Description

      Disabling press & hold like so:

      class ApplicationEventFilter : public QObject
      {
      public:
          bool eventFilter (QObject * obj, QEvent * event) {        
              switch (event->type ()) {
              case QEvent::Show:
              case QEvent::WinIdChange:
              {
                  if (obj->isWidgetType () && (((QWidget *)obj)->effectiveWinId() != 0)) {
                      HWND hWnd = (HWND) ((QWidget *)obj)->effectiveWinId();
                      qDebug ("HWND: %lld", (qint64)hWnd);                
                      ATOM atomID = 0;
                      LPCTSTR tabletAtom = TEXT("MicrosoftTabletPenServiceProperty");                  
                      atomID = GlobalAddAtom (tabletAtom);
                      if (atomID != 0) {
                          SetProp (hWnd, tabletAtom, reinterpret_cast <HANDLE> (1));
                          GlobalDeleteAtom (atomID);
                      }
                  }
              }
              break;
              default:
                  break;
              }
              return QObject::eventFilter (obj, event);
          }
      }; 

      causes QMenu only ever to behave as if it was hovered when the user tries to interact with the menu using a touch panel. Tapping on menu items will no longer trigger the corresponding actions with touch panel. Mouse input works fine.

      This seems to have worked fine until the change: https://codereview.qt-project.org/c/qt/qtbase/+/483406 (QTBUG-62912

      Attachments

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

        Activity

          People

            axelspoerl Axel Spoerl
            miikapernu Miika Pernu
            Votes:
            2 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes