diff options
| author | Richard Moe Gustavsen <richard.gustavsen@qt.io> | 2022-10-26 14:03:30 +0200 |
|---|---|---|
| committer | Richard Moe Gustavsen <richard.gustavsen@qt.io> | 2022-10-31 22:52:33 +0100 |
| commit | 7db67e59d45b47e45a2723808f23e8cdadf5065c (patch) | |
| tree | 3993c28c02c2030c121b1ccf8f3cb88266cdf806 /src/quick/handlers/qquickpointerhandler_p_p.h | |
| parent | e306b4932e7e3a2a3c5014674c36d9c6ce5c8017 (diff) | |
QQuickHoverHandler: listen for parent changes, and update hasHoverInChild
A QQuickHoverHandler is normally created by the QML engine, but
can sometimes also be created directly from C++. And for
the latter case, QQuickHoverHandler::componentComplete() will
not be called. This causes a problem, since it takes care of
subscribing for hover events on the parent item.
To support creating hover handlers from c++, we therefore need
to also subscribe to hover events from the constructor.
Moreover, since the parentItem can change at runtime, we also
need a virtual function that informs it when the parent item
changes, so that we can remove hover subscription from the old
parent, and subscribe for it on the new parent.
Pick-to: 6.4
Change-Id: I52f3cd16d6bbfbbe2e4c3c019efdc7f06c5f2c31
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'src/quick/handlers/qquickpointerhandler_p_p.h')
| -rw-r--r-- | src/quick/handlers/qquickpointerhandler_p_p.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/quick/handlers/qquickpointerhandler_p_p.h b/src/quick/handlers/qquickpointerhandler_p_p.h index be2019618a..36797ef8b3 100644 --- a/src/quick/handlers/qquickpointerhandler_p_p.h +++ b/src/quick/handlers/qquickpointerhandler_p_p.h @@ -39,6 +39,7 @@ public: bool dragOverThreshold(QVector2D delta) const; bool dragOverThreshold(const QEventPoint &point) const; + virtual void onParentChanged(QQuickItem * /*oldParent*/, QQuickItem * /*newParent*/) {} virtual void onEnabledChanged() {} static QVector<QObject *> &deviceDeliveryTargets(const QInputDevice *device); |
