Details
Description
#include <QWidget> #include <QApplication> #include <QDebug> class Widget : public QWidget { public: Widget(QWidget *parent = 0): QWidget(parent) { grabGesture(Qt::PinchGesture); } bool event(QEvent *); }; #include <QPinchGesture> bool Widget::event(QEvent* e) { if(e->type() == QEvent::Gesture) { QGestureEvent* ge = static_cast<QGestureEvent*>(e); ge->accept(Qt::PinchGesture); //< not really needed if(QPinchGesture* pinch = static_cast<QPinchGesture *>(ge->gesture(Qt::PinchGesture))) { qDebug()<<pinch->state(); } } return QWidget::event(e); } int main(int argc, char ** argv) { QApplication app(argc, argv); Widget w; w.show(); return app.exec(); }
- Compile and run the code above on a Mac with a modern trackpad;
- Begin Magnify or Rotate two finger gesture;
- Qt::GestureState(GestureStarted) is reported, then a stream of Qt::GestureState(GestureUpdated);
- complete the gesture, lifting your fingers;
- No Qt::GestureState(GestureFinished) is delivered and no future GestureStarted - only GestureUpdated for the rest of the application run!
Note: using a MacEventFilter does show all phases delivered correctly.
Attachments
For Gerrit Dashboard: QTBUG-48666 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
155384,5 | Fix gesture processing on OS X 10.11 | 5.6 | qt/qtbase | Status: MERGED | -2 | 0 |