![]() |
Qt 6.x
The Qt SDK
|
The QEventPoint class provides information about a point in a QPointerEvent. More...
#include <qeventpoint.h>
Public Types | |
enum | State : quint8 { Unknown = Qt::TouchPointUnknownState , Stationary = Qt::TouchPointStationary , Pressed = Qt::TouchPointPressed , Updated = Qt::TouchPointMoved , Released = Qt::TouchPointReleased } |
Specifies the state of this event point. More... | |
Public Member Functions | |
QEventPoint (int id=-1, const QPointingDevice *device=nullptr) | |
QEventPoint (int pointId, State state, const QPointF &scenePosition, const QPointF &globalPosition) | |
Constructs an event point with the given pointId, state, scenePosition and globalPosition. | |
QEventPoint (const QEventPoint &other) noexcept | |
Constructs an event point by making a shallow copy of other. | |
QEventPoint & | operator= (const QEventPoint &other) noexcept |
Assigns other to this event point and returns a reference to this event point. | |
QEventPoint (QEventPoint &&other) noexcept=default | |
Constructs an event point by moving other. | |
bool | operator== (const QEventPoint &other) const noexcept |
Returns true if this event point is equal to other, otherwise return false . | |
bool | operator!= (const QEventPoint &other) const noexcept |
Returns true if this event point is not equal to other, otherwise return false . | |
~QEventPoint () | |
Destroys the event point. | |
void | swap (QEventPoint &other) noexcept |
QPointF | position () const |
QPointF | pressPosition () const |
QPointF | grabPosition () const |
QPointF | lastPosition () const |
QPointF | scenePosition () const |
QPointF | scenePressPosition () const |
QPointF | sceneGrabPosition () const |
QPointF | sceneLastPosition () const |
QPointF | globalPosition () const |
QPointF | globalPressPosition () const |
QPointF | globalGrabPosition () const |
QPointF | globalLastPosition () const |
QPointF | normalizedPosition () const |
Returns the normalized position of this point. | |
QVector2D | velocity () const |
State | state () const |
const QPointingDevice * | device () const |
int | id () const |
QPointingDeviceUniqueId | uniqueId () const |
ulong | timestamp () const |
ulong | lastTimestamp () const |
ulong | pressTimestamp () const |
qreal | timeHeld () const |
qreal | pressure () const |
qreal | rotation () const |
QSizeF | ellipseDiameters () const |
bool | isAccepted () const |
void | setAccepted (bool accepted=true) |
Properties | |
bool | accepted |
the accepted state of the event point. | |
const QPointingDevice * | device |
the pointing device from which this event point originates. | |
int | id |
the ID number of this event point. | |
QPointingDeviceUniqueId | uniqueId |
the unique ID of this point or token, if any. | |
State | state |
the current state of the event point. | |
ulong | timestamp |
the most recent time at which this point was included in a QPointerEvent. | |
ulong | pressTimestamp |
the most recent time at which this point was pressed. | |
ulong | lastTimestamp |
the time from the previous QPointerEvent that contained this point. | |
qreal | timeHeld |
the duration, in seconds, since this point was pressed and not released. | |
qreal | pressure |
the pressure of this point. | |
qreal | rotation |
the angular orientation of this point. | |
QSizeF | ellipseDiameters |
the width and height of the bounding ellipse of the touch point. | |
QVector2D | velocity |
a velocity vector, in units of pixels per second, in the coordinate. | |
QPointF | position |
the position of this point. | |
QPointF | pressPosition |
the position at which this point was pressed. | |
QPointF | grabPosition |
the position at which this point was grabbed. | |
QPointF | lastPosition |
the position of this point from the previous press or move event. | |
QPointF | scenePosition |
the scene position of this point. | |
QPointF | scenePressPosition |
the scene position at which this point was pressed. | |
QPointF | sceneGrabPosition |
the scene position at which this point was grabbed. | |
QPointF | sceneLastPosition |
the scene position of this point from the previous press or move event. | |
QPointF | globalPosition |
the global position of this point. | |
QPointF | globalPressPosition |
the global position at which this point was pressed. | |
QPointF | globalGrabPosition |
the global position at which this point was grabbed. | |
QPointF | globalLastPosition |
the global position of this point from the previous press or move event. | |
Friends | |
class | QMutableEventPoint |
class | QPointerEvent |
The QEventPoint class provides information about a point in a QPointerEvent.
Definition at line 19 of file qeventpoint.h.
enum QEventPoint::State : quint8 |
Specifies the state of this event point.
\value Unknown Unknown state.
\value Stationary The event point did not move.
\value Pressed The touch point or button is pressed.
\value Updated The event point was updated.
\value Released The touch point or button was released.
Enumerator | |
---|---|
Unknown | |
Stationary | |
Pressed | |
Updated | |
Released |
Definition at line 49 of file qeventpoint.h.
|
explicit |
Constructs an invalid event point with the given id and the device from which it originated.
This acts as a default constructor in usages like QMap<int, QEventPoint>, as in qgraphicsscene_p.h.
Definition at line 50 of file qeventpoint.cpp.
QEventPoint::QEventPoint | ( | int | pointId, |
State | state, | ||
const QPointF & | scenePosition, | ||
const QPointF & | globalPosition | ||
) |
Constructs an event point with the given pointId, state, scenePosition and globalPosition.
Definition at line 57 of file qeventpoint.cpp.
|
defaultnoexcept |
Constructs an event point by making a shallow copy of other.
|
defaultnoexcept |
Constructs an event point by moving other.
|
default |
Destroys the event point.
const QPointingDevice * QEventPoint::device | ( | ) | const |
Definition at line 283 of file qeventpoint.cpp.
References QEventPointPrivate::device.
QSizeF QEventPoint::ellipseDiameters | ( | ) | const |
Definition at line 379 of file qeventpoint.cpp.
References QEventPointPrivate::ellipseDiameters.
QPointF QEventPoint::globalGrabPosition | ( | ) | const |
Definition at line 239 of file qeventpoint.cpp.
References QEventPointPrivate::globalGrabPos.
QPointF QEventPoint::globalLastPosition | ( | ) | const |
Definition at line 250 of file qeventpoint.cpp.
References QEventPointPrivate::globalLastPos.
QPointF QEventPoint::globalPosition | ( | ) | const |
Definition at line 217 of file qeventpoint.cpp.
References QEventPointPrivate::globalPos.
QPointF QEventPoint::globalPressPosition | ( | ) | const |
Definition at line 228 of file qeventpoint.cpp.
References QEventPointPrivate::globalPressPos.
QPointF QEventPoint::grabPosition | ( | ) | const |
Definition at line 143 of file qeventpoint.cpp.
References QEventPointPrivate::globalGrabPos, QEventPointPrivate::globalPos, and QEventPointPrivate::pos.
int QEventPoint::id | ( | ) | const |
Definition at line 294 of file qeventpoint.cpp.
References QEventPointPrivate::pointId.
bool QEventPoint::isAccepted | ( | ) | const |
Definition at line 404 of file qeventpoint.cpp.
References QEventPointPrivate::accept.
Referenced by QQuickDeliveryAgentPrivate::deliverSinglePointEventUntilAccepted().
QPointF QEventPoint::lastPosition | ( | ) | const |
Definition at line 154 of file qeventpoint.cpp.
References QEventPointPrivate::globalLastPos, QEventPointPrivate::globalPos, and QEventPointPrivate::pos.
ulong QEventPoint::lastTimestamp | ( | ) | const |
Definition at line 328 of file qeventpoint.cpp.
References QEventPointPrivate::lastTimestamp.
QPointF QEventPoint::normalizedPosition | ( | ) | const |
Returns the normalized position of this point.
The coordinates are calculated by transforming globalPosition() into the space of QInputDevice::availableVirtualGeometry(), i.e. (0, 0) is the top-left corner and
(1, 1) is the bottom-right corner.
Definition at line 422 of file qeventpoint.cpp.
References QInputDevice::availableVirtualGeometry, QEventPointPrivate::device, and globalPosition.
Referenced by QtWayland::TouchExtensionGlobal::postTouchEvent().
|
inlinenoexcept |
Returns true
if this event point is not equal to other, otherwise return false
.
Definition at line 66 of file qeventpoint.h.
References operator==(), and other().
|
defaultnoexcept |
Assigns other to this event point and returns a reference to this event point.
Move-assigns other to this event point instance.
|
noexcept |
Returns true
if this event point is equal to other, otherwise return false
.
Definition at line 87 of file qeventpoint.cpp.
QPointF QEventPoint::position | ( | ) | const |
Definition at line 121 of file qeventpoint.cpp.
References QEventPointPrivate::pos.
QPointF QEventPoint::pressPosition | ( | ) | const |
Definition at line 132 of file qeventpoint.cpp.
References QEventPointPrivate::globalPos, QEventPointPrivate::globalPressPos, and QEventPointPrivate::pos.
ulong QEventPoint::pressTimestamp | ( | ) | const |
Definition at line 337 of file qeventpoint.cpp.
References QEventPointPrivate::pressTimestamp.
qreal QEventPoint::pressure | ( | ) | const |
Definition at line 355 of file qeventpoint.cpp.
References QEventPointPrivate::pressure.
qreal QEventPoint::rotation | ( | ) | const |
Definition at line 367 of file qeventpoint.cpp.
References QEventPointPrivate::rotation.
QPointF QEventPoint::sceneGrabPosition | ( | ) | const |
Definition at line 193 of file qeventpoint.cpp.
References QEventPointPrivate::globalGrabPos, QEventPointPrivate::globalPos, and QEventPointPrivate::scenePos.
QPointF QEventPoint::sceneLastPosition | ( | ) | const |
Definition at line 206 of file qeventpoint.cpp.
References QEventPointPrivate::globalLastPos, QEventPointPrivate::globalPos, and QEventPointPrivate::scenePos.
QPointF QEventPoint::scenePosition | ( | ) | const |
Definition at line 167 of file qeventpoint.cpp.
References QEventPointPrivate::scenePos.
QPointF QEventPoint::scenePressPosition | ( | ) | const |
Definition at line 180 of file qeventpoint.cpp.
References QEventPointPrivate::globalPos, QEventPointPrivate::globalPressPos, and QEventPointPrivate::scenePos.
void QEventPoint::setAccepted | ( | bool | accepted = true | ) |
Definition at line 398 of file qeventpoint.cpp.
References QEventPointPrivate::accept, and accepted.
Referenced by QQuickDeliveryAgentPrivate::deliverMatchingPointsToItem(), QQuickDeliveryAgentPrivate::deliverSinglePointEventUntilAccepted(), QQuickPointerHandler::onGrabChanged(), QGuiApplicationPrivate::processTouchEvent(), QQuickDeliveryAgentPrivate::sendFilteredPointerEventImpl(), and QQuickSinglePointHandler::wantsPointerEvent().
QEventPoint::State QEventPoint::state | ( | ) | const |
Definition at line 276 of file qeventpoint.cpp.
References QEventPointPrivate::state, and Unknown.
|
inlinenoexcept |
qreal QEventPoint::timeHeld | ( | ) | const |
Definition at line 346 of file qeventpoint.cpp.
References QEventPointPrivate::pressTimestamp, and QEventPointPrivate::timestamp.
ulong QEventPoint::timestamp | ( | ) | const |
Definition at line 319 of file qeventpoint.cpp.
References QEventPointPrivate::timestamp.
QPointingDeviceUniqueId QEventPoint::uniqueId | ( | ) | const |
Definition at line 310 of file qeventpoint.cpp.
References QEventPointPrivate::uniqueId.
QVector2D QEventPoint::velocity | ( | ) | const |
Definition at line 269 of file qeventpoint.cpp.
References QEventPointPrivate::velocity.
|
friend |
Definition at line 130 of file qeventpoint.h.
|
friend |
Definition at line 131 of file qeventpoint.h.
|
readwrite |
the accepted state of the event point.
In widget-based applications, this property is not used, as it's only meaningful for a widget to accept or reject a complete QInputEvent.
In Qt Quick however, it's normal for an Item or Event Handler to accept only the individual points in a QTouchEvent that are actually participating in a gesture, while other points can be delivered to other items or handlers. For the sake of consistency, that applies to any QPointerEvent; and delivery is done only when all points in a QPointerEvent have been accepted.
Definition at line 141 of file qeventpoint.h.
Referenced by setAccepted().
|
read |
the pointing device from which this event point originates.
Definition at line 141 of file qeventpoint.h.
Referenced by QQuickDeliveryAgentPrivate::onGrabChanged().
|
read |
the width and height of the bounding ellipse of the touch point.
The return value is in logical pixels. Most touchscreens do not detect the shape of the contact point, and no mice or tablet devices can detect it, so a null size is the most common value. On some touchscreens the diameters may be nonzero and always equal (the ellipse is approximated as a circle).
Definition at line 141 of file qeventpoint.h.
Referenced by operator<<(), QtWayland::TouchExtensionGlobal::postTouchEvent(), QQuickHandlerPoint::reset(), and QWindowSystemInterfacePrivate::toNativeTouchPoint().
|
read |
the global position at which this point was grabbed.
The global position is relative to the screen or virtual desktop.
Definition at line 141 of file qeventpoint.h.
|
read |
the global position of this point from the previous press or move event.
The global position is relative to the screen or virtual desktop.
Definition at line 141 of file qeventpoint.h.
|
read |
the global position of this point.
The global position is relative to the screen or virtual desktop.
Definition at line 141 of file qeventpoint.h.
Referenced by QApplicationPrivate::findClosestTouchPointTarget(), normalizedPosition(), operator<<(), QSwipeGestureRecognizer::recognize(), QTapGestureRecognizer::recognize(), QFlickGestureRecognizer::recognize(), QGraphicsScenePrivate::sendTouchBeginEvent(), QPointingDevicePrivate::setExclusiveGrabber(), and QWindowSystemInterfacePrivate::toNativeTouchPoint().
|
read |
the global position at which this point was pressed.
The global position is relative to the screen or virtual desktop.
Definition at line 141 of file qeventpoint.h.
Referenced by QPanGestureRecognizer::recognize(), QSwipeGestureRecognizer::recognize(), and QTapAndHoldGestureRecognizer::recognize().
|
read |
the position at which this point was grabbed.
The position is relative to the widget or item that received the event.
Definition at line 141 of file qeventpoint.h.
|
read |
the ID number of this event point.
Definition at line 141 of file qeventpoint.h.
Referenced by QPointingDevicePrivate::addPassiveGrabber(), QQuickMultiPointTouchArea::addTouchPoint(), QQuickPointerHandler::approveGrabTransition(), QPointingDevicePrivate::clearPassiveGrabbers(), QPointerEvent::exclusiveGrabber(), QApplicationPrivate::findClosestTouchPointTarget(), QQuickDeliveryAgentPrivate::onGrabChanged(), QQuickMultiPointHandler::onGrabChanged(), operator<<(), QPointerEvent::passiveGrabbers(), QQuickDeliveryAgentPrivate::pointerTargets(), QtWayland::TouchExtensionGlobal::postTouchEvent(), QGuiApplicationPrivate::processTouchEvent(), QPointingDevicePrivate::removePassiveGrabber(), QQuickHandlerPoint::reset(), QWaylandTouch::sendFullTouchEvent(), QGraphicsScenePrivate::sendTouchBeginEvent(), QPointingDevicePrivate::setExclusiveGrabber(), QWindowSystemInterfacePrivate::toNativeTouchPoint(), QQuickPointerHandler::wantsEventPoint(), and QQuickSinglePointHandler::wantsPointerEvent().
|
read |
the position of this point from the previous press or move event.
The position is relative to the widget or item that received the event.
Definition at line 141 of file qeventpoint.h.
Referenced by operator<<().
|
read |
the time from the previous QPointerEvent that contained this point.
Definition at line 141 of file qeventpoint.h.
|
read |
the position of this point.
The position is relative to the widget or item that received the event.
Definition at line 141 of file qeventpoint.h.
Referenced by operator<<(), QtWayland::TouchExtensionGlobal::postTouchEvent(), QTapGestureRecognizer::recognize(), QQuickHandlerPoint::reset(), and QWaylandTouch::sendFullTouchEvent().
|
read |
the position at which this point was pressed.
The position is relative to the widget or item that received the event.
Definition at line 141 of file qeventpoint.h.
Referenced by operator<<().
|
read |
the most recent time at which this point was pressed.
Definition at line 141 of file qeventpoint.h.
|
read |
the pressure of this point.
The return value is in the range 0.0
to 1.0
.
Definition at line 141 of file qeventpoint.h.
Referenced by operator<<(), QtWayland::TouchExtensionGlobal::postTouchEvent(), QQuickHandlerPoint::reset(), and QWindowSystemInterfacePrivate::toNativeTouchPoint().
|
read |
the angular orientation of this point.
The return value is in degrees, where zero (the default) indicates the finger, token or stylus is pointing upwards, a negative angle means it's rotated to the left, and a positive angle means it's rotated to the right. Most touchscreens do not detect rotation, so zero is the most common value.
Definition at line 141 of file qeventpoint.h.
Referenced by operator<<(), and QQuickHandlerPoint::reset().
|
read |
the scene position at which this point was grabbed.
The scene position is the position relative to QQuickWindow if handled in QQuickItem::event(), in QGraphicsScene coordinates if handled by an override of QGraphicsItem::touchEvent(), or the window position in widget applications.
Definition at line 141 of file qeventpoint.h.
|
read |
the scene position of this point from the previous press or move event.
The scene position is the position relative to QQuickWindow if handled in QQuickItem::event(), in QGraphicsScene coordinates if handled by an override of QGraphicsItem::touchEvent(), or the window position in widget applications.
Definition at line 141 of file qeventpoint.h.
Referenced by QQuickDeliveryAgent::event().
|
read |
the scene position of this point.
The scene position is the position relative to QQuickWindow if handled in QQuickItem::event(), in QGraphicsScene coordinates if handled by an override of QGraphicsItem::touchEvent(), or the window position in widget applications.
Definition at line 141 of file qeventpoint.h.
Referenced by QQuickPointerHandlerPrivate::dragOverThreshold(), QQuickPointerHandler::eventPos(), QQuickMultiPointHandler::onGrabChanged(), operator<<(), QQuickPointerHandler::parentContains(), QQuickDeliveryAgentPrivate::pointerTargets(), QFlickGestureRecognizer::recognize(), QQuickHandlerPoint::reset(), QGraphicsScenePrivate::sendTouchBeginEvent(), QPointingDevicePrivate::setExclusiveGrabber(), and QQuickPointerHandler::wantsEventPoint().
|
read |
the scene position at which this point was pressed.
The scene position is the position relative to QQuickWindow if handled in QQuickItem::event(), in QGraphicsScene coordinates if handled by an override of QGraphicsItem::touchEvent(), or the window position in widget applications.
Definition at line 141 of file qeventpoint.h.
Referenced by QQuickPointerHandlerPrivate::dragOverThreshold(), and QFlickGestureRecognizer::recognize().
|
read |
the current state of the event point.
Definition at line 141 of file qeventpoint.h.
Referenced by QPointingDevicePrivate::addPassiveGrabber(), QMutableTouchEvent::addPoint(), QPointingDevicePrivate::clearPassiveGrabbers(), QQuickMultiPointHandler::hasCurrentPoints(), operator<<(), QtWayland::TouchExtensionGlobal::postTouchEvent(), QPointingDevicePrivate::removePassiveGrabber(), QQuickHandlerPoint::reset(), QWaylandTouch::sendFullTouchEvent(), QPointingDevicePrivate::setExclusiveGrabber(), and QWindowSystemInterfacePrivate::toNativeTouchPoint().
|
read |
the duration, in seconds, since this point was pressed and not released.
Definition at line 141 of file qeventpoint.h.
|
read |
the most recent time at which this point was included in a QPointerEvent.
Definition at line 141 of file qeventpoint.h.
Referenced by QQuickDeliveryAgentPrivate::clonePointerEvent(), and operator<<().
|
read |
the unique ID of this point or token, if any.
It is often invalid (see \l {QPointingDeviceUniqueId::isValid()} {isValid()}), because touchscreens cannot uniquely identify fingers.
When it comes from a QTabletEvent, it identifies the serial number of the stylus in use.
It may identify a specific token (fiducial object) when the TUIO driver is in use with a touchscreen that supports them.
Definition at line 141 of file qeventpoint.h.
Referenced by QQuickHandlerPoint::reset().
|
read |
a velocity vector, in units of pixels per second, in the coordinate.
system of the screen or desktop.
Velocity
capability is not set, indicating that the velocity is calculated by Qt, using a simple Kalman filter to provide a smoothed average velocity rather than an instantaneous value. Effectively it tells how fast and in what direction the user has been dragging this point over the last few events, with the most recent event having the strongest influence.Definition at line 141 of file qeventpoint.h.
Referenced by QQuickDeliveryAgentPrivate::dragOverThreshold(), operator<<(), QtWayland::TouchExtensionGlobal::postTouchEvent(), QQuickHandlerPoint::reset(), and QWindowSystemInterfacePrivate::toNativeTouchPoint().