diff options
| author | Shawn Rutledge <shawn.rutledge@qt.io> | 2024-02-16 20:21:32 -0700 |
|---|---|---|
| committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2024-02-21 15:24:39 -0700 |
| commit | 5a762ba09cdeb8df5cf54ce562bc60dfcc11c97f (patch) | |
| tree | 824cdc693cbda19cafc776851ae0da26b9ad3cf1 /tests/auto/quick/pointerhandlers/qquickhoverhandler/tst_qquickhoverhandler.cpp | |
| parent | 7d1dd8d71d51bb5dc745660b7a704f1856a25e39 (diff) | |
HoverHandler: setHovered(false) for any pointer event outside bounds
8e822e981d91e688799c8670f11dfdf6aaf9e0d1 was expecting HoverHandler to
receive a QTabletEvent when hover leaves. That worked before
bbcc2657fa0dbf715e6db7d675662e4be94a1e04: a HoverHandler had a passive
grab, so it would receive the next QTabletEvent that moved outside the
item. Now that we stopped doing passive grabs, the event that indicates
that the cursor is leaving the item is always a QMouseEvent sent from
QQuickDeliveryAgentPrivate::deliverHoverEvent().
If the mouse event says the cursor is outside the item, it doesn't
matter what device it came from: this handler is no longer hovered.
But as before, if the position is still inside, and a particular
HoverHandler is hovered because a tablet stylus was previously detected,
do not un-hover merely because of a synth-mouse event at the same
position. Amends 79893e1773be9d04208243cb88c1daf793d830a4
Fixes: QTBUG-116505
Task-number: QTBUG-101932
Pick-to: 6.5 6.6 6.7
Change-Id: Id0b622fad524ae4be8b37b9cb55e68384056964a
Reviewed-by: Doris Verria <doris.verria@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Diffstat (limited to 'tests/auto/quick/pointerhandlers/qquickhoverhandler/tst_qquickhoverhandler.cpp')
| -rw-r--r-- | tests/auto/quick/pointerhandlers/qquickhoverhandler/tst_qquickhoverhandler.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/auto/quick/pointerhandlers/qquickhoverhandler/tst_qquickhoverhandler.cpp b/tests/auto/quick/pointerhandlers/qquickhoverhandler/tst_qquickhoverhandler.cpp index ace99daa6a..920bf77978 100644 --- a/tests/auto/quick/pointerhandlers/qquickhoverhandler/tst_qquickhoverhandler.cpp +++ b/tests/auto/quick/pointerhandlers/qquickhoverhandler/tst_qquickhoverhandler.cpp @@ -571,6 +571,17 @@ void tst_HoverHandler::deviceCursor() QCOMPARE(eraserHandler->isHovered(), false); QCOMPARE(aibrushHandler->isHovered(), false); QCOMPARE(airbrushEraserHandler->isHovered(), true); // there was no fresh QTabletEvent to tell it not to be hovered + + // hover with the stylus again, then move the mouse outside the handlers' parent item + testStylusDevice(QInputDevice::DeviceType::Stylus, QPointingDevice::PointerType::Pen, + Qt::CrossCursor, stylusHandler); + QTest::mouseMove(&window, QPoint(180, 180)); + // the mouse has left the item: all its HoverHandlers should be unhovered (QTBUG-116505) + QCOMPARE(stylusHandler->isHovered(), false); + QCOMPARE(eraserHandler->isHovered(), false); + QCOMPARE(aibrushHandler->isHovered(), false); + QCOMPARE(airbrushEraserHandler->isHovered(), false); + QCOMPARE(mouseHandler->isHovered(), false); } void tst_HoverHandler::addHandlerFromCpp() |
