summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qevent.h
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@qt.io>2020-09-03 18:17:21 +0200
committerShawn Rutledge <shawn.rutledge@qt.io>2020-09-10 14:21:47 +0200
commita81859a3c8d0f8b4367fc63988e1d653d34ed48a (patch)
tree3ed5fee25bbc1cd254d07802b59766f846ca5385 /src/gui/kernel/qevent.h
parent62f5ecca7d2b193236cd4e5ccfc96290541b9fff (diff)
Move grabbing API from QEventPoint to QPointerEvent
We plan to move storage of the grabbers into QPointingDevice so that QEventPoint will store only data that does not need to persist between deliveries of individual events. These API changes prepare for that. addPassiveGrabber/removePassiveGrabber is a better API than setPassiveGrabbers(), because it will never require constructing a temporary QList just to call the function. Eventually we need to emit signals to notify about grab changes, so it's better to have incremental changes to the list rather than needing to iterate and find differences. Fix up the docs. QEventPoint IDs are no longer written in hex in debug output. That was done in Qt 5 because an ID was a composite of device ID with the OS-provided touchpoint ID; but since the QPointingDevice is always available, it's more readable if the IDs are in decimal. Change-Id: I86b9016d9b28c331ca05c7c108d9788de93fb642 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/gui/kernel/qevent.h')
-rw-r--r--src/gui/kernel/qevent.h25
1 files changed, 14 insertions, 11 deletions
diff --git a/src/gui/kernel/qevent.h b/src/gui/kernel/qevent.h
index eed6b93156..dd9e76dcd9 100644
--- a/src/gui/kernel/qevent.h
+++ b/src/gui/kernel/qevent.h
@@ -164,15 +164,11 @@ public:
bool isAccepted() const;
void setAccepted(bool accepted = true);
- QObject *exclusiveGrabber() const;
- void setExclusiveGrabber(QObject *exclusiveGrabber);
- const QList<QPointer <QObject>> &passiveGrabbers() const;
- void setPassiveGrabbers(const QList<QPointer <QObject>> &grabbers);
- void clearPassiveGrabbers();
private:
QEventPointPrivate *d;
friend class QMutableEventPoint;
+ friend class QPointerEvent;
};
#ifndef QT_NO_DEBUG_STREAM
@@ -182,18 +178,25 @@ Q_GUI_EXPORT QDebug operator<<(QDebug, const QEventPoint &);
class Q_GUI_EXPORT QPointerEvent : public QInputEvent
{
public:
+ explicit QPointerEvent(Type type, const QPointingDevice *dev, Qt::KeyboardModifiers modifiers = Qt::NoModifier);
virtual ~QPointerEvent();
+ const QPointingDevice *pointingDevice() const;
+ QPointingDevice::PointerType pointerType() const {
+ return pointingDevice() ? pointingDevice()->pointerType() : QPointingDevice::PointerType::Unknown;
+ }
virtual int pointCount() const = 0;
virtual const QEventPoint &point(int i) const = 0;
virtual bool isPressEvent() const { return false; }
virtual bool isUpdateEvent() const { return false; }
virtual bool isReleaseEvent() const { return false; }
-
- explicit QPointerEvent(Type type, const QPointingDevice *dev, Qt::KeyboardModifiers modifiers = Qt::NoModifier);
- const QPointingDevice *pointingDevice() const;
- QPointingDevice::PointerType pointerType() const {
- return pointingDevice() ? pointingDevice()->pointerType() : QPointingDevice::PointerType::Unknown;
- }
+ bool isPointAccepted(const QEventPoint &point) const;
+ void setPointAccepted(const QEventPoint &point, bool accepted = true);
+ QObject *exclusiveGrabber(const QEventPoint &point) const;
+ void setExclusiveGrabber(const QEventPoint &point, QObject *exclusiveGrabber);
+ QList<QPointer <QObject>> passiveGrabbers(const QEventPoint &point) const;
+ void clearPassiveGrabbers(const QEventPoint &point);
+ bool addPassiveGrabber(const QEventPoint &point, QObject *grabber);
+ bool removePassiveGrabber(const QEventPoint &point, QObject *grabber);
};
class Q_GUI_EXPORT QSinglePointEvent : public QPointerEvent