Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
QEventPoint Class Reference

The QEventPoint class provides information about a point in a QPointerEvent. More...

#include <qeventpoint.h>

+ Inheritance diagram for QEventPoint:
+ Collaboration diagram for QEventPoint:

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.
 
QEventPointoperator= (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 QPointingDevicedevice () 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 QPointingDevicedevice
 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
 

Detailed Description

The QEventPoint class provides information about a point in a QPointerEvent.

Since
6.0 \inmodule QtGui

Definition at line 19 of file qeventpoint.h.

Member Enumeration Documentation

◆ State

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 48 of file qeventpoint.h.

Constructor & Destructor Documentation

◆ QEventPoint() [1/4]

QEventPoint::QEventPoint ( int id = -1,
const QPointingDevice * device = nullptr )
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() [2/4]

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.

◆ QEventPoint() [3/4]

QEventPoint::QEventPoint ( const QEventPoint & other)
defaultnoexcept

Constructs an event point by making a shallow copy of other.

◆ QEventPoint() [4/4]

QEventPoint::QEventPoint ( QEventPoint && other)
defaultnoexcept

Constructs an event point by moving other.

◆ ~QEventPoint()

QEventPoint::~QEventPoint ( )
default

Destroys the event point.

Member Function Documentation

◆ device()

const QPointingDevice * QEventPoint::device ( ) const

Definition at line 283 of file qeventpoint.cpp.

References QEventPointPrivate::device.

◆ ellipseDiameters()

QSizeF QEventPoint::ellipseDiameters ( ) const

Definition at line 379 of file qeventpoint.cpp.

References QEventPointPrivate::ellipseDiameters.

◆ globalGrabPosition()

QPointF QEventPoint::globalGrabPosition ( ) const

Definition at line 239 of file qeventpoint.cpp.

References QEventPointPrivate::globalGrabPos.

◆ globalLastPosition()

QPointF QEventPoint::globalLastPosition ( ) const

Definition at line 250 of file qeventpoint.cpp.

References QEventPointPrivate::globalLastPos.

◆ globalPosition()

QPointF QEventPoint::globalPosition ( ) const

Definition at line 217 of file qeventpoint.cpp.

References QEventPointPrivate::globalPos.

◆ globalPressPosition()

QPointF QEventPoint::globalPressPosition ( ) const

Definition at line 228 of file qeventpoint.cpp.

References QEventPointPrivate::globalPressPos.

◆ grabPosition()

QPointF QEventPoint::grabPosition ( ) const

◆ id()

int QEventPoint::id ( ) const

Definition at line 294 of file qeventpoint.cpp.

References QEventPointPrivate::pointId.

◆ isAccepted()

bool QEventPoint::isAccepted ( ) const

Definition at line 404 of file qeventpoint.cpp.

References QEventPointPrivate::accept.

Referenced by QQuickDeliveryAgentPrivate::deliverSinglePointEventUntilAccepted().

+ Here is the caller graph for this function:

◆ lastPosition()

QPointF QEventPoint::lastPosition ( ) const

◆ lastTimestamp()

ulong QEventPoint::lastTimestamp ( ) const

Definition at line 328 of file qeventpoint.cpp.

References QEventPointPrivate::lastTimestamp.

◆ normalizedPosition()

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.

See also
globalPosition

Definition at line 422 of file qeventpoint.cpp.

References QInputDevice::availableVirtualGeometry, QEventPointPrivate::device, and globalPosition.

Referenced by QtWayland::TouchExtensionGlobal::postTouchEvent().

+ Here is the caller graph for this function:

◆ operator!=()

bool QEventPoint::operator!= ( const QEventPoint & other) const
inlinenoexcept

Returns true if this event point is not equal to other, otherwise return false.

Definition at line 65 of file qeventpoint.h.

References operator==(), and other().

+ Here is the call graph for this function:

◆ operator=()

QEventPoint & QEventPoint::operator= ( const QEventPoint & other)
defaultnoexcept

Assigns other to this event point and returns a reference to this event point.

Move-assigns other to this event point instance.

◆ operator==()

bool QEventPoint::operator== ( const QEventPoint & other) const
noexcept

Returns true if this event point is equal to other, otherwise return false.

Definition at line 87 of file qeventpoint.cpp.

References d, and other().

+ Here is the call graph for this function:

◆ position()

QPointF QEventPoint::position ( ) const

Definition at line 121 of file qeventpoint.cpp.

References QEventPointPrivate::pos.

◆ pressPosition()

QPointF QEventPoint::pressPosition ( ) const

◆ pressTimestamp()

ulong QEventPoint::pressTimestamp ( ) const

Definition at line 337 of file qeventpoint.cpp.

References QEventPointPrivate::pressTimestamp.

◆ pressure()

qreal QEventPoint::pressure ( ) const

Definition at line 355 of file qeventpoint.cpp.

References QEventPointPrivate::pressure.

◆ rotation()

qreal QEventPoint::rotation ( ) const

Definition at line 367 of file qeventpoint.cpp.

References QEventPointPrivate::rotation.

◆ sceneGrabPosition()

QPointF QEventPoint::sceneGrabPosition ( ) const

◆ sceneLastPosition()

QPointF QEventPoint::sceneLastPosition ( ) const

◆ scenePosition()

QPointF QEventPoint::scenePosition ( ) const

Definition at line 167 of file qeventpoint.cpp.

References QEventPointPrivate::scenePos.

◆ scenePressPosition()

QPointF QEventPoint::scenePressPosition ( ) const

◆ setAccepted()

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(), and QQuickDeliveryAgentPrivate::sendFilteredPointerEventImpl().

+ Here is the caller graph for this function:

◆ state()

QEventPoint::State QEventPoint::state ( ) const

Definition at line 276 of file qeventpoint.cpp.

References QEventPointPrivate::state, and Unknown.

◆ swap()

void QEventPoint::swap ( QEventPoint & other)
inlinenoexcept

Definition at line 67 of file qeventpoint.h.

References d, and other().

+ Here is the call graph for this function:

◆ timeHeld()

qreal QEventPoint::timeHeld ( ) const

◆ timestamp()

ulong QEventPoint::timestamp ( ) const

Definition at line 319 of file qeventpoint.cpp.

References QEventPointPrivate::timestamp.

◆ uniqueId()

QPointingDeviceUniqueId QEventPoint::uniqueId ( ) const

Definition at line 310 of file qeventpoint.cpp.

References QEventPointPrivate::uniqueId.

◆ velocity()

QVector2D QEventPoint::velocity ( ) const

Definition at line 269 of file qeventpoint.cpp.

References QEventPointPrivate::velocity.

Friends And Related Symbol Documentation

◆ QMutableEventPoint

friend class QMutableEventPoint
friend

Definition at line 129 of file qeventpoint.h.

◆ QPointerEvent

friend class QPointerEvent
friend

Definition at line 130 of file qeventpoint.h.

Property Documentation

◆ accepted

QEventPoint::accepted
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.

See also
QEvent::accepted

Definition at line 22 of file qeventpoint.h.

Referenced by setAccepted().

◆ device

QEventPoint::device
read

the pointing device from which this event point originates.

Definition at line 23 of file qeventpoint.h.

Referenced by QQuickDeliveryAgentPrivate::onGrabChanged().

◆ ellipseDiameters

QEventPoint::ellipseDiameters
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 33 of file qeventpoint.h.

Referenced by operator<<(), QtWayland::TouchExtensionGlobal::postTouchEvent(), QQuickHandlerPoint::reset(), and QWindowSystemInterfacePrivate::toNativeTouchPoint().

◆ globalGrabPosition

QEventPoint::globalGrabPosition
read

the global position at which this point was grabbed.

The global position is relative to the screen or virtual desktop.

See also
globalPosition, grabPosition, sceneGrabPosition

Definition at line 45 of file qeventpoint.h.

◆ globalLastPosition

QEventPoint::globalLastPosition
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.

See also
globalPosition, lastPosition, sceneLastPosition

Definition at line 46 of file qeventpoint.h.

◆ globalPosition

QEventPoint::globalPosition
read

the global position of this point.

The global position is relative to the screen or virtual desktop.

See also
globalPressPosition, position, scenePosition

Definition at line 43 of file qeventpoint.h.

Referenced by QApplicationPrivate::findClosestTouchPointTarget(), normalizedPosition(), operator<<(), QPointingDevicePrivate::setExclusiveGrabber(), and QWindowSystemInterfacePrivate::toNativeTouchPoint().

◆ globalPressPosition

QEventPoint::globalPressPosition
read

the global position at which this point was pressed.

The global position is relative to the screen or virtual desktop.

See also
globalPosition, pressPosition, scenePressPosition

Definition at line 44 of file qeventpoint.h.

Referenced by QTapAndHoldGestureRecognizer::recognize().

◆ grabPosition

QEventPoint::grabPosition
read

the position at which this point was grabbed.

The position is relative to the widget or item that received the event.

See also
position

Definition at line 37 of file qeventpoint.h.

◆ id

◆ lastPosition

QEventPoint::lastPosition
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.

See also
position, pressPosition

Definition at line 38 of file qeventpoint.h.

Referenced by operator<<().

◆ lastTimestamp

QEventPoint::lastTimestamp
read

the time from the previous QPointerEvent that contained this point.

See also
globalLastPosition

Definition at line 29 of file qeventpoint.h.

◆ position

QEventPoint::position
read

the position of this point.

The position is relative to the widget or item that received the event.

Definition at line 35 of file qeventpoint.h.

Referenced by operator<<(), QtWayland::TouchExtensionGlobal::postTouchEvent(), QTapGestureRecognizer::recognize(), QQuickHandlerPoint::reset(), and QWaylandTouch::sendFullTouchEvent().

◆ pressPosition

QEventPoint::pressPosition
read

the position at which this point was pressed.

The position is relative to the widget or item that received the event.

See also
position

Definition at line 36 of file qeventpoint.h.

Referenced by operator<<().

◆ pressTimestamp

QEventPoint::pressTimestamp
read

the most recent time at which this point was pressed.

See also
timestamp

Definition at line 28 of file qeventpoint.h.

◆ pressure

QEventPoint::pressure
read

the pressure of this point.

The return value is in the range 0.0 to 1.0.

Definition at line 31 of file qeventpoint.h.

Referenced by operator<<(), QtWayland::TouchExtensionGlobal::postTouchEvent(), QQuickHandlerPoint::reset(), and QWindowSystemInterfacePrivate::toNativeTouchPoint().

◆ rotation

QEventPoint::rotation
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 32 of file qeventpoint.h.

Referenced by operator<<(), and QQuickHandlerPoint::reset().

◆ sceneGrabPosition

QEventPoint::sceneGrabPosition
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.

See also
scenePosition, grabPosition, globalGrabPosition

Definition at line 41 of file qeventpoint.h.

◆ sceneLastPosition

QEventPoint::sceneLastPosition
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.

See also
scenePosition, scenePressPosition

Definition at line 42 of file qeventpoint.h.

Referenced by QQuickDeliveryAgent::event().

◆ scenePosition

QEventPoint::scenePosition
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.

See also
scenePressPosition, position, globalPosition

Definition at line 39 of file qeventpoint.h.

Referenced by QQuickPointerHandlerPrivate::dragOverThreshold(), QQuickPointerHandler::eventPos(), QQuickMultiPointHandler::onGrabChanged(), operator<<(), QQuickPointerHandler::parentContains(), QQuickDeliveryAgentPrivate::pointerTargets(), QQuickHandlerPoint::reset(), QPointingDevicePrivate::setExclusiveGrabber(), and QQuickPointerHandler::wantsEventPoint().

◆ scenePressPosition

QEventPoint::scenePressPosition
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.

See also
scenePosition, pressPosition, globalPressPosition

Definition at line 40 of file qeventpoint.h.

Referenced by QQuickPointerHandlerPrivate::dragOverThreshold().

◆ state

◆ timeHeld

QEventPoint::timeHeld
read

the duration, in seconds, since this point was pressed and not released.

See also
pressTimestamp, timestamp

Definition at line 30 of file qeventpoint.h.

◆ timestamp

QEventPoint::timestamp
read

the most recent time at which this point was included in a QPointerEvent.

See also
QPointerEvent::timestamp()

Definition at line 27 of file qeventpoint.h.

Referenced by QQuickDeliveryAgentPrivate::clonePointerEvent(), and operator<<().

◆ uniqueId

QEventPoint::uniqueId
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 25 of file qeventpoint.h.

Referenced by QQuickHandlerPoint::reset().

◆ velocity

QEventPoint::velocity
read

a velocity vector, in units of pixels per second, in the coordinate.

system of the screen or desktop.

Note
If the device's capabilities include QInputDevice::Velocity, it means velocity comes from the operating system (perhaps the touch hardware or driver provides it). But usually the 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.
See also
QInputDevice::capabilities(), QInputEvent::device()

Definition at line 34 of file qeventpoint.h.

Referenced by QQuickDeliveryAgentPrivate::dragOverThreshold(), operator<<(), QtWayland::TouchExtensionGlobal::postTouchEvent(), QQuickHandlerPoint::reset(), and QWindowSystemInterfacePrivate::toNativeTouchPoint().


The documentation for this class was generated from the following files: