diff options
author | J-P Nurmi <jpnurmi@qt.io> | 2016-10-15 13:19:07 +0200 |
---|---|---|
committer | J-P Nurmi <jpnurmi@qt.io> | 2016-10-15 18:19:47 +0000 |
commit | 654e9e6a35682d2dbd468b82a954b55fef8b6e70 (patch) | |
tree | 77cffa18a5af6c7a92f40506bb16377950001081 /tests | |
parent | 6d732026a518741718528052656a513761451b31 (diff) |
QQuickWindow: don't discard timestamps for wheel events
Noticed while debugging QTBUG-56075 on XCB. QQuickFlickable did not
receive timestamps for wheel events provided by XI2. This alone does
not fix the flicking speed issue with high-precision trackpads, but
is needed to be able to calculate the appropriate velocity.
Task-number: QTBUG-56075
Change-Id: I458e6302aee72863cdc1f8e8f7d99449016905a9
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/quick/qquickitem/tst_qquickitem.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/tests/auto/quick/qquickitem/tst_qquickitem.cpp b/tests/auto/quick/qquickitem/tst_qquickitem.cpp index a403b3e42b..3a9b752f6c 100644 --- a/tests/auto/quick/qquickitem/tst_qquickitem.cpp +++ b/tests/auto/quick/qquickitem/tst_qquickitem.cpp @@ -53,7 +53,7 @@ public: TestItem(QQuickItem *parent = 0) : QQuickItem(parent), focused(false), pressCount(0), releaseCount(0) , wheelCount(0), acceptIncomingTouchEvents(true) - , touchEventReached(false) {} + , touchEventReached(false), timestamp(0) {} bool focused; int pressCount; @@ -61,6 +61,7 @@ public: int wheelCount; bool acceptIncomingTouchEvents; bool touchEventReached; + ulong timestamp; protected: virtual void focusInEvent(QFocusEvent *) { Q_ASSERT(!focused); focused = true; } virtual void focusOutEvent(QFocusEvent *) { Q_ASSERT(focused); focused = false; } @@ -70,7 +71,7 @@ protected: touchEventReached = true; event->setAccepted(acceptIncomingTouchEvents); } - virtual void wheelEvent(QWheelEvent *event) { event->accept(); ++wheelCount; } + virtual void wheelEvent(QWheelEvent *event) { event->accept(); ++wheelCount; timestamp = event->timestamp(); } }; class TestWindow: public QQuickWindow @@ -1435,12 +1436,14 @@ void tst_qquickitem::wheelEvent() item->setVisible(visible); QWheelEvent event(QPoint(100, 50), -120, Qt::NoButton, Qt::NoModifier, Qt::Vertical); + event.setTimestamp(123456UL); event.setAccepted(false); QGuiApplication::sendEvent(&window, &event); if (shouldReceiveWheelEvents) { QVERIFY(event.isAccepted()); QCOMPARE(item->wheelCount, 1); + QCOMPARE(item->timestamp, 123456UL); } else { QVERIFY(!event.isAccepted()); QCOMPARE(item->wheelCount, 0); |