IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)

QEventPoint Class

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

This class was introduced in Qt 6.0.

Article lu   fois.

L'auteur

Liens sociaux

Viadeo Twitter Facebook Share on Google+   

QEventPoint Class

  • Header: QEventPoint

  • Since: Qt 6.0

  • CMake:

    find_package(Qt6 REQUIRED COMPONENTS Gui)

    target_link_libraries(mytarget PRIVATE Qt6::Gui)

  • qmake: QT += gui

Detailed Description

 

Member Type Documentation

 

enum QEventPoint::State

flags QEventPoint::States

Specifies the state of this event point.

Constant

Value

Description

QEventPoint::Unknown

Qt::TouchPointUnknownState

Unknown state.

QEventPoint::Stationary

Qt::TouchPointStationary

The event point did not move.

QEventPoint::Pressed

Qt::TouchPointPressed

The touch point or button is pressed.

QEventPoint::Updated

Qt::TouchPointMoved

The event point was updated.

QEventPoint::Released

Qt::TouchPointReleased

The touch point or button was released.

The States type is a typedef for QFlags<State>. It stores an OR combination of State values.

Property Documentation

 

accepted : bool

This property holds 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.

Access functions:

  • bool isAccepted() const

  • void setAccepted(bool accepted = true)

See Also

See also QEvent::accepted

[read-only] device : QPointingDevice* const

This property holds the pointing device from which this event point originates.

Access functions:

[read-only] ellipseDiameters : const QSizeF

This property holds 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).

Access functions:

  • ellipseDiameters() const

[read-only] globalGrabPosition : const QPointF

This property holds the global position at which this point was grabbed.

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

Access functions:

  • globalGrabPosition() const

See Also

[read-only] globalLastPosition : const QPointF

This property holds the global position of this point from the previous press or move event.

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

Access functions:

  • globalLastPosition() const

See Also

[read-only] globalPosition : const QPointF

This property holds the global position of this point.

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

Access functions:

  • globalPosition() const

See Also

[read-only] globalPressPosition : const QPointF

This property holds the global position at which this point was pressed.

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

Access functions:

  • globalPressPosition() const

See Also

[read-only] grabPosition : const QPointF

This property holds the position at which this point was grabbed.

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

Access functions:

  • grabPosition() const

See Also

See also position

[read-only] id : const int

This property holds the ID number of this event point.

Do not assume that ID numbers start at zero or that they are sequential. Such an assumption is often false due to the way the underlying drivers work.

Access functions:

  • int id() const

[read-only] lastPosition : const QPointF

This property holds 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.

Access functions:

  • lastPosition() const

See Also

[read-only] lastTimestamp : const ulong

This property holds the time from the previous QPointerEvent that contained this point.

Access functions:

  • ulong lastTimestamp() const

See Also

[read-only] position : const QPointF

This property holds the position of this point.

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

Access functions:

  • position() const

[read-only] pressPosition : const QPointF

This property holds the position at which this point was pressed.

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

Access functions:

  • pressPosition() const

See Also

See also position

[read-only] pressTimestamp : const ulong

This property holds the most recent time at which this point was pressed.

Access functions:

  • ulong pressTimestamp() const

See Also

See also timestamp

[read-only] pressure : const qreal

This property holds the pressure of this point.

The return value is in the range 0.0 to 1.0.

Access functions:

  • qreal pressure() const

[read-only] rotation : const qreal

This property holds 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.

Access functions:

  • qreal rotation() const

[read-only] sceneGrabPosition : const QPointF

This property holds 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.

Access functions:

  • sceneGrabPosition() const

See Also

[read-only] sceneLastPosition : const QPointF

This property holds 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.

Access functions:

  • sceneLastPosition() const

See Also

[read-only] scenePosition : const QPointF

This property holds 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.

Access functions:

  • scenePosition() const

See Also

[read-only] scenePressPosition : const QPointF

This property holds 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.

Access functions:

  • scenePressPosition() const

See Also

[read-only] state : const State

This property holds the current state of the event point.

Access functions:

  • state() const

[read-only] timeHeld : const qreal

This property holds the duration, in milliseconds, since this point was pressed and not released.

Access functions:

  • qreal timeHeld() const

See Also

[read-only] timestamp : const ulong

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

Access functions:

  • ulong timestamp() const

See Also

[read-only] uniqueId : const QPointingDeviceUniqueId

This property holds the unique ID of this point or token, if any.

It is often invalid (see 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.

Access functions:

  • uniqueId() const

[read-only] velocity : const QVector2D

This property holds a velocity vector, in units of pixels per second, in the coordinate. system of the screen or desktop.

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.

Access functions:

  • velocity() const

See Also

Member Function Documentation

 

QEventPoint::QEventPoint(int pointId, QEventPoint::State state, const QPointF &scenePosition, const QPointF &globalPosition)

Constructs an event point with the given pointId, state, scenePosition and globalPosition.

QEventPoint::QEventPoint(const QEventPoint &other)

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

QEventPoint::QEventPoint(QEventPoint &&other)

Constructs an event point by moving other.

QEventPoint::~QEventPoint()

Destroys the event point.

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

See also globalPosition

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

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

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

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

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

Move-assigns other to this event point instance.

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

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

Obsolete Members for QEventPoint

The following members of class QEventPoint are deprecated. We strongly advise against using them in new code.

Obsolete Member Function Documentation

 
QPointF QEventPoint::lastNormalizedPos() const

This function is deprecated since 6.0. We strongly advise against using it in new code.

Use globalLastPosition() instead.

Returns the normalized position of this point from the previous press or move event.

The coordinates are normalized to QInputDevice::availableVirtualGeometry(), i.e. (0, 0) is the top-left corner and (1, 1) is the bottom-right corner.

See Also
QPointF QEventPoint::normalizedPos() const

This function is deprecated since 6.0. We strongly advise against using it in new code.

Use normalizedPosition() instead.

QPointF QEventPoint::pos() const

This function is deprecated since 6.0. We strongly advise against using it in new code.

Use position() instead.

Returns the position of this point, relative to the widget or item that received the event.

QPointF QEventPoint::startNormalizedPos() const

This function is deprecated since 6.0. We strongly advise against using it in new code.

Use globalPressPosition() instead.

Returns the normalized press position of this point.

Vous avez aimé ce tutoriel ? Alors partagez-le en cliquant sur les boutons suivants : Viadeo Twitter Facebook Share on Google+