aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@qt.io>2021-07-02 19:49:45 +0200
committerShawn Rutledge <shawn.rutledge@qt.io>2021-07-06 13:02:58 +0200
commit1775bbc6d4231fd10ccfcea006d78d8769b854a2 (patch)
tree9d4f0258203ef9a7e4e220199468d13f055a3be8
parent76edc77a3a05ec9b9578035d18dfa90acba0a2fe (diff)
QQDeliveryAgent: keep lastMousePosition updated during dragging
Given that we store lastMousePosition (which I hope we can move to QPointingDevice eventually), the idea is it should always be correct; so don't bypass updating it during a mouse move just because there's a grabber. It resulted in synthetic hover events being sent after release, with an outdated last-known mouse position. Fixes: QTBUG-92563 Change-Id: Ic708bfcbdfcd0a9f6dc2cfd42f0671b0661e76bb Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit 930da44767dcd0ccb50aaf725e3cbac99eaf13ea)
-rw-r--r--src/quick/util/qquickdeliveryagent.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/quick/util/qquickdeliveryagent.cpp b/src/quick/util/qquickdeliveryagent.cpp
index 72b532d0a4..098e215829 100644
--- a/src/quick/util/qquickdeliveryagent.cpp
+++ b/src/quick/util/qquickdeliveryagent.cpp
@@ -1366,10 +1366,10 @@ void QQuickDeliveryAgentPrivate::handleMouseEvent(QMouseEvent *event)
#if QT_CONFIG(cursor)
QQuickWindowPrivate::get(rootItem->window())->updateCursor(event->scenePosition());
#endif
+ const QPointF last = lastMousePosition.isNull() ? event->scenePosition() : lastMousePosition;
+ lastMousePosition = event->scenePosition();
+ qCDebug(lcHoverTrace) << q << "mouse pos" << last << "->" << lastMousePosition;
if (!event->points().count() || !event->exclusiveGrabber(event->point(0))) {
- QPointF last = lastMousePosition.isNull() ? event->scenePosition() : lastMousePosition;
- lastMousePosition = event->scenePosition();
- qCDebug(lcHoverTrace) << q << "mouse pos" << last << "->" << lastMousePosition << event;
bool accepted = event->isAccepted();
bool delivered = deliverHoverEvent(rootItem, event->scenePosition(), last, event->modifiers(), event->timestamp(), accepted);
if (!delivered) {
@@ -1413,7 +1413,7 @@ void QQuickDeliveryAgentPrivate::flushFrameSynchronousEvents(QQuickWindow *win)
if (frameSynchronousHoverEnabled && !win->mouseGrabberItem() &&
!lastMousePosition.isNull() && QQuickWindowPrivate::get(win)->dirtyItemList) {
bool accepted = false;
- qCDebug(lcHoverTrace) << q << "delivering frame-sync hover to root";
+ qCDebug(lcHoverTrace) << q << "delivering frame-sync hover to root @" << lastMousePosition;
bool delivered = deliverHoverEvent(rootItem, lastMousePosition, lastMousePosition, QGuiApplication::keyboardModifiers(), 0, accepted);
if (!delivered)
clearHover(); // take care of any exits