![]() |
Qt 6.x
The Qt SDK
|
A base class for pointer events. More...
#include <qevent.h>
Public Member Functions | |
QPointerEvent (Type type, const QPointingDevice *dev, Qt::KeyboardModifiers modifiers=Qt::NoModifier, const QList< QEventPoint > &points={}) | |
const QPointingDevice * | pointingDevice () const |
Returns the source device from which this event originates. | |
QPointingDevice::PointerType | pointerType () const |
Returns the type of point that generated the event. | |
void | setTimestamp (quint64 timestamp) override |
qsizetype | pointCount () const |
Returns the number of points in this pointer event. | |
QEventPoint & | point (qsizetype i) |
Returns a QEventPoint reference for the point at index i. | |
const QList< QEventPoint > & | points () const |
Returns a list of points in this pointer event. | |
QEventPoint * | pointById (int id) |
Returns the point whose \l {QEventPoint::id()}{id} matches the given id, or nullptr if no such point is found. | |
bool | allPointsGrabbed () const |
Returns true if every point in points() has either an exclusiveGrabber() or one or more passiveGrabbers(). | |
virtual bool | isBeginEvent () const |
virtual bool | isUpdateEvent () const |
virtual bool | isEndEvent () const |
bool | allPointsAccepted () const |
Returns true if isPointAccepted() is true for every point in points(); otherwise false . | |
virtual void | setAccepted (bool accepted) override |
\reimp | |
QObject * | exclusiveGrabber (const QEventPoint &point) const |
Returns the object which has been set to receive all future update events and the release event containing the given point. | |
void | setExclusiveGrabber (const QEventPoint &point, QObject *exclusiveGrabber) |
Informs the delivery logic that the given exclusiveGrabber is to receive all future update events and the release event containing the given point, and that delivery to other items can be skipped. | |
QList< QPointer< QObject > > | passiveGrabbers (const QEventPoint &point) const |
Returns the list of objects that have been requested to receive all future update events and the release event containing the given point. | |
void | clearPassiveGrabbers (const QEventPoint &point) |
Removes all passive grabbers from the given point. | |
bool | addPassiveGrabber (const QEventPoint &point, QObject *grabber) |
Informs the delivery logic that the given grabber is to receive all future update events and the release event containing the given point, regardless where else those events may be delivered. | |
bool | removePassiveGrabber (const QEventPoint &point, QObject *grabber) |
Removes the passive grabber from the given point if it was previously added. | |
![]() | |
QInputEvent (Type type, const QInputDevice *m_dev, Qt::KeyboardModifiers modifiers=Qt::NoModifier) | |
const QInputDevice * | device () const |
QInputDevice::DeviceType | deviceType () const |
Returns the type of device that generated the event. | |
Qt::KeyboardModifiers | modifiers () const |
Returns the keyboard modifier flags that existed immediately before the event occurred. | |
void | setModifiers (Qt::KeyboardModifiers modifiers) |
quint64 | timestamp () const |
Returns the window system's timestamp for this event. | |
virtual void | setTimestamp (quint64 timestamp) |
![]() | |
QEvent (Type type) | |
Constructs an event object of type type. | |
virtual | ~QEvent () |
Destroys the event. | |
Type | type () const |
Returns the event type. | |
bool | spontaneous () const |
Returns true if the event originated outside the application (a system event); otherwise returns false . | |
virtual void | setAccepted (bool accepted) |
bool | isAccepted () const |
void | accept () |
Sets the accept flag of the event object, the equivalent of calling setAccepted(true). | |
void | ignore () |
Clears the accept flag parameter of the event object, the equivalent of calling setAccepted(false). | |
bool | isInputEvent () const noexcept |
bool | isPointerEvent () const noexcept |
bool | isSinglePointEvent () const noexcept |
virtual QEvent * | clone () const |
Creates and returns an identical copy of this event. | |
Protected Member Functions | |
QPointerEvent (Type type, SinglePointEventTag, const QInputDevice *dev, Qt::KeyboardModifiers modifiers=Qt::NoModifier) | |
![]() | |
QInputEvent (Type type, PointerEventTag, const QInputDevice *dev, Qt::KeyboardModifiers modifiers=Qt::NoModifier) | |
QInputEvent (Type type, SinglePointEventTag, const QInputDevice *dev, Qt::KeyboardModifiers modifiers=Qt::NoModifier) | |
![]() | |
QEvent (Type type, InputEventTag) | |
QEvent (Type type, PointerEventTag) | |
QEvent (Type type, SinglePointEventTag) | |
Protected Attributes | |
QList< QEventPoint > | m_points |
![]() | |
const QInputDevice * | m_dev = nullptr |
quint64 | m_timeStamp = 0 |
Qt::KeyboardModifiers | m_modState = Qt::NoModifier |
quint32 | m_reserved = 0 |
![]() | |
quint16 | t |
|
explicit |
|
protected |
bool QPointerEvent::addPassiveGrabber | ( | const QEventPoint & | point, |
QObject * | grabber | ||
) |
Informs the delivery logic that the given grabber is to receive all future update events and the release event containing the given point, regardless where else those events may be delivered.
It's only for use by \l {Qt Quick Input Handlers}.
Returns false
if grabber was already added, true
otherwise.
Definition at line 401 of file qevent.cpp.
References QPointingDevicePrivate::get(), point(), pointingDevice(), and Q_ASSERT.
bool QPointerEvent::allPointsAccepted | ( | ) | const |
Returns true
if isPointAccepted() is true
for every point in points(); otherwise false
.
Definition at line 303 of file qevent.cpp.
bool QPointerEvent::allPointsGrabbed | ( | ) | const |
Returns true
if every point in points() has either an exclusiveGrabber() or one or more passiveGrabbers().
Definition at line 290 of file qevent.cpp.
References exclusiveGrabber(), QList< T >::isEmpty(), and passiveGrabbers().
void QPointerEvent::clearPassiveGrabbers | ( | const QEventPoint & | point | ) |
Removes all passive grabbers from the given point.
It's only for use by \l {Qt Quick Input Handlers}.
Definition at line 430 of file qevent.cpp.
References QPointingDevicePrivate::get(), point(), pointingDevice(), and Q_ASSERT.
Referenced by QQuickWindowPrivate::clearGrabbers(), QGuiApplicationPrivate::processMouseEvent(), and QPointingDevicePrivate::sendTouchCancelEvent().
QObject * QPointerEvent::exclusiveGrabber | ( | const QEventPoint & | point | ) | const |
Returns the object which has been set to receive all future update events and the release event containing the given point.
It's mainly for use in Qt Quick at this time.
Definition at line 348 of file qevent.cpp.
References QPointingDevicePrivate::get(), QEventPoint::id, point(), pointingDevice(), Q_ASSERT, Q_UNLIKELY, QPointingDevicePrivate::queryPointById(), and qWarning.
Referenced by allPointsGrabbed(), QQuickDeliveryAgentPrivate::allPointsGrabbed(), QQuickDeliveryAgentPrivate::anyPointGrabbed(), QQuickPathView::childMouseEventFilter(), QQuickDeliveryAgentPrivate::deliverMatchingPointsToItem(), QQuickDeliveryAgentPrivate::deliverToPassiveGrabbers(), QQuickDeliveryAgentPrivate::deliverTouchAsMouse(), QQuickWidget::event(), QQuickDeliveryAgentPrivate::exclusiveGrabbers(), QSinglePointEvent::exclusivePointGrabber(), QQuickPointerHandler::setExclusiveGrab(), and setExclusiveGrabber().
|
inlinevirtual |
Reimplemented in QSinglePointEvent, and QTouchEvent.
Definition at line 89 of file qevent.h.
Referenced by QQuickDeliveryAgentPrivate::deliverMatchingPointsToItem().
|
inlinevirtual |
Reimplemented in QSinglePointEvent, and QTouchEvent.
Definition at line 91 of file qevent.h.
Referenced by QQuickWindowPrivate::clearGrabbers(), and QQuickDeliveryAgentPrivate::deliverMatchingPointsToItem().
|
inlinevirtual |
Reimplemented in QSinglePointEvent, QHoverEvent, and QTouchEvent.
Definition at line 90 of file qevent.h.
Referenced by QQuickDeliveryAgentPrivate::deliverMatchingPointsToItem().
QList< QPointer< QObject > > QPointerEvent::passiveGrabbers | ( | const QEventPoint & | point | ) | const |
Returns the list of objects that have been requested to receive all future update events and the release event containing the given point.
It's only for use by \l {Qt Quick Input Handlers}.
Definition at line 381 of file qevent.cpp.
References QPointingDevicePrivate::get(), QEventPoint::id, point(), pointingDevice(), Q_ASSERT, Q_UNLIKELY, QPointingDevicePrivate::queryPointById(), and qWarning.
Referenced by allPointsGrabbed(), QQuickDeliveryAgentPrivate::allPointsGrabbed(), and QQuickDeliveryAgentPrivate::anyPointGrabbed().
QEventPoint & QPointerEvent::point | ( | qsizetype | i | ) |
Returns a QEventPoint reference for the point at index i.
Definition at line 237 of file qevent.cpp.
References i.
Referenced by addPassiveGrabber(), QMutableTouchEvent::addPoint(), QQuickPathView::childMouseEventFilter(), QQuickWindowPrivate::clearGrabbers(), clearPassiveGrabbers(), QQuickDeliveryAgentPrivate::deliverMatchingPointsToItem(), QQuickDeliveryAgentPrivate::deliverToPassiveGrabbers(), QApplicationPrivate::dispatchEnterLeave(), exclusiveGrabber(), QQuickSwipeDelegatePrivate::forwardMouseEvent(), QQuickDeliveryAgentPrivate::localizePointerEvent(), QApplication::notify(), passiveGrabbers(), removePassiveGrabber(), QQuickDeliveryAgentPrivate::sendFilteredPointerEventImpl(), QQuickDeliveryAgentPrivate::sendHoverEvent(), QQuickMultiPointTouchArea::sendMouseEvent(), and setExclusiveGrabber().
QEventPoint * QPointerEvent::pointById | ( | int | id | ) |
Returns the point whose \l {QEventPoint::id()}{id} matches the given id, or nullptr
if no such point is found.
Definition at line 277 of file qevent.cpp.
References m_points.
|
inline |
Returns the number of points in this pointer event.
Definition at line 84 of file qevent.h.
Referenced by QQuickDeliveryAgentPrivate::localizePointerEvent().
|
inline |
Returns the type of point that generated the event.
Definition at line 80 of file qevent.h.
References QPointingDevice::Unknown.
const QPointingDevice * QPointerEvent::pointingDevice | ( | ) | const |
Returns the source device from which this event originates.
This is the same as QInputEvent::device() but typecast for convenience.
Definition at line 327 of file qevent.cpp.
References QInputEvent::m_dev.
Referenced by addPassiveGrabber(), QMutableTouchEvent::addPoint(), clearPassiveGrabbers(), QQuickDeliveryAgentPrivate::deliverTouchAsMouse(), exclusiveGrabber(), QQuickHoverHandler::handleEventPoint(), QQuickDeliveryAgentPrivate::mousePointData(), QApplication::notify(), passiveGrabbers(), QFlickGestureRecognizer::recognize(), removePassiveGrabber(), PressDelayHandler::sendMouseEvent(), setExclusiveGrabber(), QGraphicsScenePrivate::touchEventHandler(), QApplicationPrivate::translateRawTouchEvent(), and QQuickMultiPointTouchArea::updateTouchData().
|
inline |
Returns a list of points in this pointer event.
Definition at line 86 of file qevent.h.
Referenced by QQuickDeliveryAgentPrivate::allPointsGrabbed(), QQuickDeliveryAgentPrivate::allUpdatedPointsAccepted(), QQuickDeliveryAgentPrivate::anyPointGrabbed(), QQuickPathView::childMouseEventFilter(), QQuickSplitView::childMouseEventFilter(), QQuickWindowPrivate::clearGrabbers(), QQuickWidget::event(), QQuickDeliveryAgent::event(), QQuickDeliveryAgentPrivate::exclusiveGrabbers(), QMacPanGestureRecognizer::recognize(), QPanGestureRecognizer::recognize(), QPinchGestureRecognizer::recognize(), QSwipeGestureRecognizer::recognize(), QTapGestureRecognizer::recognize(), QTapAndHoldGestureRecognizer::recognize(), QFlickGestureRecognizer::recognize(), QPointingDevicePrivate::sendTouchCancelEvent(), QQuickMultiPointTouchArea::shouldFilter(), QGraphicsScenePrivate::touchEventHandler(), QApplicationPrivate::translateRawTouchEvent(), and QQuickMultiPointTouchArea::updateTouchData().
bool QPointerEvent::removePassiveGrabber | ( | const QEventPoint & | point, |
QObject * | grabber | ||
) |
Removes the passive grabber from the given point if it was previously added.
Returns true
if it had been a passive grabber before, false
if not.
It's only for use by \l {Qt Quick Input Handlers}.
Definition at line 416 of file qevent.cpp.
References QPointingDevicePrivate::get(), point(), pointingDevice(), and Q_ASSERT.
|
overridevirtual |
\reimp
Reimplemented from QEvent.
Definition at line 315 of file qevent.cpp.
References m_points, and QEvent::setAccepted().
Referenced by QQuickFlickablePrivate::captureDelayedPress(), QQuickPathView::childMouseEventFilter(), QQuickDeliveryAgentPrivate::deliverHoverEventToItem(), QQuickDeliveryAgent::event(), QGraphicsViewPrivate::mouseMoveEventHandler(), QApplication::notify(), QQuickDeliveryAgentPrivate::sendHoverEvent(), QQuickMouseArea::sendMouseEvent(), and QQuickMultiPointTouchArea::sendMouseEvent().
void QPointerEvent::setExclusiveGrabber | ( | const QEventPoint & | point, |
QObject * | exclusiveGrabber | ||
) |
Informs the delivery logic that the given exclusiveGrabber is to receive all future update events and the release event containing the given point, and that delivery to other items can be skipped.
It's mainly for use in Qt Quick at this time.
Definition at line 366 of file qevent.cpp.
References exclusiveGrabber(), QPointingDevicePrivate::get(), point(), pointingDevice(), and Q_ASSERT.
Referenced by QQuickPathView::childMouseEventFilter(), QQuickWindowPrivate::clearGrabbers(), QQuickDeliveryAgentPrivate::deliverMatchingPointsToItem(), QQuickDeliveryAgentPrivate::deliverTouchAsMouse(), QGuiApplicationPrivate::processMouseEvent(), QQuickDeliveryAgentPrivate::removeGrabber(), QPointingDevicePrivate::sendTouchCancelEvent(), QQuickPointerHandler::setExclusiveGrab(), and QSinglePointEvent::setExclusivePointGrabber().
Sets the timestamp for this event and its points().
Reimplemented from QInputEvent.
Definition at line 335 of file qevent.cpp.
References m_points, QMutableEventPoint::setTimestamp(), QInputEvent::setTimestamp(), and QInputEvent::timestamp().
Referenced by copyMouseEvent(), QQuickDeliveryAgentPrivate::deliverHoverEventToItem(), QQuickWindow::event(), QtQuickTest::mouseEvent(), QApplication::notify(), QGuiApplicationPrivate::processMouseEvent(), QGuiApplicationPrivate::processTouchEvent(), QQuickDeliveryAgentPrivate::sendHoverEvent(), and QGraphicsProxyWidgetPrivate::sendWidgetMouseEvent().
|
protected |
Definition at line 104 of file qevent.h.
Referenced by QMutableTouchEvent::addPoint(), pointById(), setAccepted(), and setTimestamp().