Details
-
Bug
-
Resolution: Unresolved
-
P1: Critical
-
None
-
5.12.0
-
None
-
macOS 10.13.6 (17G4015)
Xcode 10.1 (10B61)
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.)