diff options
author | Tarja Sundqvist <tarja.sundqvist@qt.io> | 2022-11-10 22:42:29 +0200 |
---|---|---|
committer | Tarja Sundqvist <tarja.sundqvist@qt.io> | 2022-11-10 22:42:29 +0200 |
commit | f5701f0def37fcc0c2b38ae9552eb3a896a34687 (patch) | |
tree | aa9a7ebb39bedb6794f199d94525f5ddfb696308 /src/quick/handlers/qquickhoverhandler.cpp | |
parent | da0aac1057552048f59075beb31861a6cc076684 (diff) | |
parent | e24effdceb3a504182ae271200408750991aa94a (diff) |
Merge remote-tracking branch 'origin/tqtc/lts-5.15.8' into tqtc/lts-5.15-opensourcev5.15.8-lts-lgpl
Change-Id: I2e0f34eea87c1393dff82f153650eccf5048248f
Diffstat (limited to 'src/quick/handlers/qquickhoverhandler.cpp')
-rw-r--r-- | src/quick/handlers/qquickhoverhandler.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/quick/handlers/qquickhoverhandler.cpp b/src/quick/handlers/qquickhoverhandler.cpp index b12d85784a..3361415eac 100644 --- a/src/quick/handlers/qquickhoverhandler.cpp +++ b/src/quick/handlers/qquickhoverhandler.cpp @@ -85,8 +85,11 @@ QQuickHoverHandler::~QQuickHoverHandler() void QQuickHoverHandler::componentComplete() { - parentItem()->setAcceptHoverEvents(true); - QQuickItemPrivate::get(parentItem())->setHasHoverInChild(true); + QQuickSinglePointHandler::componentComplete(); + if (auto par = parentItem()) { + par->setAcceptHoverEvents(true); + QQuickItemPrivate::get(par)->setHasHoverInChild(true); + } } bool QQuickHoverHandler::wantsPointerEvent(QQuickPointerEvent *event) @@ -124,6 +127,13 @@ void QQuickHoverHandler::handleEventPoint(QQuickEventPoint *point) setPassiveGrab(point); } +void QQuickHoverHandler::onGrabChanged(QQuickPointerHandler *grabber, QQuickEventPoint::GrabTransition transition, QQuickEventPoint *point) +{ + QQuickSinglePointHandler::onGrabChanged(grabber, transition, point); + if (grabber == this && transition == QQuickEventPoint::CancelGrabPassive) + setHovered(false); +} + /*! \qmlproperty bool QtQuick::HoverHandler::hovered \readonly |