Details
-
Type:
Bug
-
Status: Reported
-
Priority:
P1: Critical
-
Resolution: Unresolved
-
Affects Version/s: 5.12.0
-
Fix Version/s: None
-
Component/s: Widgets: Gesture Support
-
Labels:None
-
Environment:macOS 10.13.6 (17G4015)
Xcode 10.1 (10B61)
-
Platform/s:
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.)