summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qevent.h
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@qt.io>2020-10-16 10:12:36 +0200
committerShawn Rutledge <shawn.rutledge@qt.io>2020-10-20 09:17:35 +0200
commit5683c0afdaf942e81ba614bd44eda0cc59d0d7a1 (patch)
treeb2930368d8dc838d4efc9bb4ee9a4021da73b7b1 /src/gui/kernel/qevent.h
parent6089888d1d6c2b6ab6b8b788ccec951b58292cd8 (diff)
Add QSinglePointEvent::exclusivePointGrabber convenience property
Since a single-point event (such as a QMouseEvent) only carries one point, it only has one grabber, so we can have a normal Q_PROPERTY. It's named exclusivePointGrabber to avoid shadowing the QPointerEvent::[set]exclusiveGrabber functions that take QEventPoint&. Change-Id: Ie18f1c1849ed057b98f229de7b17b7fc3f3eea36 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'src/gui/kernel/qevent.h')
-rw-r--r--src/gui/kernel/qevent.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/gui/kernel/qevent.h b/src/gui/kernel/qevent.h
index 6abbae07be..07d5be51c6 100644
--- a/src/gui/kernel/qevent.h
+++ b/src/gui/kernel/qevent.h
@@ -233,6 +233,9 @@ protected:
class Q_GUI_EXPORT QSinglePointEvent : public QPointerEvent
{
+ Q_GADGET
+ Q_PROPERTY(QObject *exclusivePointGrabber READ exclusivePointGrabber WRITE setExclusivePointGrabber)
+
public:
QSinglePointEvent(Type type, const QPointingDevice *dev, const QPointF &localPos,
const QPointF &scenePos, const QPointF &globalPos,
@@ -253,6 +256,11 @@ public:
bool isUpdateEvent() const override;
bool isEndEvent() const override;
+ QObject *exclusivePointGrabber() const
+ { return QPointerEvent::exclusiveGrabber(points().first()); }
+ void setExclusivePointGrabber(QObject *exclusiveGrabber)
+ { QPointerEvent::setExclusiveGrabber(points().first(), exclusiveGrabber); }
+
protected:
QSinglePointEvent(Type type, const QPointingDevice *dev, const QEventPoint &point,
Qt::MouseButton button, Qt::MouseButtons buttons,