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

QWidgets never receive swipe gestures

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Reported
    • Priority: P1: Critical
    • Resolution: Unresolved
    • Affects Version/s: 5.12.0
    • Fix Version/s: None
    • Labels:
      None
    • Environment:
      macOS 10.13.6 (17G4015)
      Xcode 10.1 (10B61)
    • Platform/s:
      iOS/tvOS/watchOS

      Description

      Trying to grab swipe gestures on QWidget objects with grabGesture(Qt::SwipeGesture) does not work. QWidget::event() never receives a QGestureEvent. Grabbing other gestures (like Qt::TapGesture or Qt::TapHoldGesture) works fine. Qt::SwipeGesture does not.

      Code that reproduces the issue:

      #include <QApplication>
      #include <QGestureEvent>
      #include <QMainWindow>
      
      class MainWindow: public QMainWindow
      {
      protected:
          bool event(QEvent* e) override
          {
              if (e->type() == QEvent::Gesture) {
                  auto* gestEv = static_cast<QGestureEvent*>(e);
                  if (gestEv->gesture(Qt::SwipeGesture) != nullptr) {
                      abort();
                  }
              }
              return false;
          }
      };
      
      int main(int argc, char* argv[])
      {
          QApplication a(argc, argv);
          MainWindow w;
          w.grabGesture(Qt::SwipeGesture);
          w.show();
          return a.exec();
      }
      

      Swiping does not abort the app. This is true for both the iOS Simulator as well as real hardware (iPhone 8 and iPad Air.)

        Attachments

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

          Activity

            People

            Assignee:
            qt.team.quick.subscriptions Qt Quick and Widgets Team
            Reporter:
            realnc Nikos Chantziaras
            Votes:
            2 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:

                Gerrit Reviews

                There are no open Gerrit changes