TouchPoint

The TouchPoint class provides information about a touch point in a QTouchEvent . More

New in version 4.6.

Synopsis

Functions

Detailed Description

../../_images/touchpoint-metrics.png
class PySide2.QtGui.TouchPoint(other)

PySide2.QtGui.TouchPoint([id=-1])

param id

int

param other

PySide2.QtGui.TouchPoint

Constructs a TouchPoint for use in a QTouchEvent .

PySide2.QtGui.TouchPoint.InfoFlag

The values of this enum describe additional information about a touch point.

Constant

Description

QTouchEvent.TouchPoint.Pen

Indicates that the contact has been made by a designated pointing device (e.g. a pen) instead of a finger.

QTouchEvent.TouchPoint.Token

Indicates that the contact has been made by a fiducial object (e.g. a knob or other token) instead of a finger.

PySide2.QtGui.TouchPoint.ellipseDiameters()
Return type

PySide2.QtCore.QSizeF

Returns the width and height of the bounding ellipse of this touch point. The return value is in logical pixels. Most touchscreens do not detect the shape of the contact point, so a null size is the most common value. In other cases the diameters may be nonzero and equal (the ellipse is approximated as a circle).

PySide2.QtGui.TouchPoint.flags()
Return type

InfoFlags

Returns additional information about the touch point.

See also

InfoFlags

PySide2.QtGui.TouchPoint.id()
Return type

int

Returns the id number of this touch 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.

PySide2.QtGui.TouchPoint.lastNormalizedPos()
Return type

PySide2.QtCore.QPointF

Returns the normalized position of this touch point from the previous touch event.

The coordinates are normalized to the size of the touch device, i.e. (0,0) is the top-left corner and (1,1) is the bottom-right corner.

See also

normalizedPos() startNormalizedPos()

PySide2.QtGui.TouchPoint.lastPos()
Return type

PySide2.QtCore.QPointF

Returns the position of this touch point from the previous touch event, relative to the widget or QGraphicsItem that received the event.

See also

pos() startPos()

PySide2.QtGui.TouchPoint.lastScenePos()
Return type

PySide2.QtCore.QPointF

Returns the scene position of this touch point from the previous touch event.

The scene position is the position in QGraphicsScene coordinates if the QTouchEvent is handled by a QGraphicsItem::touchEvent() reimplementation, and identical to the screen position for widgets.

See also

scenePos() startScenePos()

PySide2.QtGui.TouchPoint.lastScreenPos()
Return type

PySide2.QtCore.QPointF

Returns the screen position of this touch point from the previous touch event.

See also

screenPos() startScreenPos()

PySide2.QtGui.TouchPoint.normalizedPos()
Return type

PySide2.QtCore.QPointF

Returns the normalized position of this touch point.

The coordinates are normalized to the size of the touch device, i.e. (0,0) is the top-left corner and (1,1) is the bottom-right corner.

See also

startNormalizedPos() lastNormalizedPos() pos()

PySide2.QtGui.TouchPoint.pos()
Return type

PySide2.QtCore.QPointF

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

See also

startPos() lastPos() screenPos() scenePos() normalizedPos()

PySide2.QtGui.TouchPoint.pressure()
Return type

float

Returns the pressure of this touch point. The return value is in the range 0.0 to 1.0.

PySide2.QtGui.TouchPoint.rawScreenPositions()
Return type

Returns the raw, unfiltered positions for the touch point. The positions are in native screen coordinates. To get local coordinates you can use mapFromGlobal() of the QWindow returned by window() .

Note

Returns an empty vector if the touch device’s capabilities do not include RawPositions .

Note

Native screen coordinates refer to the native orientation of the screen which, in case of mobile devices, is typically portrait. This means that on systems capable of screen orientation changes the positions in this list will not reflect the current orientation (unlike pos() , screenPos() , etc.) and will always be reported in the native orientation.

See also

capabilities() device() window()

PySide2.QtGui.TouchPoint.rect()
Return type

PySide2.QtCore.QRectF

Note

This function is deprecated.

This function is deprecated since 5.9 because it returns the outer bounds of the touchpoint regardless of rotation, whereas a touchpoint is more correctly modeled as an ellipse at position pos() with ellipseDiameters() which are independent of rotation() .

PySide2.QtGui.TouchPoint.rotation()
Return type

float

Returns the angular orientation of this touch point. The return value is in degrees, where zero (the default) indicates the finger or token 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.

PySide2.QtGui.TouchPoint.scenePos()
Return type

PySide2.QtCore.QPointF

Returns the scene position of this touch point.

The scene position is the position in QGraphicsScene coordinates if the QTouchEvent is handled by a QGraphicsItem::touchEvent() reimplementation, and identical to the screen position for widgets.

See also

startScenePos() lastScenePos() pos()

PySide2.QtGui.TouchPoint.sceneRect()
Return type

PySide2.QtCore.QRectF

Note

This function is deprecated.

This function is deprecated since 5.9 because it returns the outer bounds of the touchpoint regardless of rotation, whereas a touchpoint is more correctly modeled as an ellipse at position scenePos() with ellipseDiameters() which are independent of rotation() .

PySide2.QtGui.TouchPoint.screenPos()
Return type

PySide2.QtCore.QPointF

Returns the screen position of this touch point.

See also

startScreenPos() lastScreenPos() pos()

PySide2.QtGui.TouchPoint.screenRect()
Return type

PySide2.QtCore.QRectF

Note

This function is deprecated.

This function is deprecated since 5.9 because it returns the outer bounds of the touchpoint regardless of rotation, whereas a touchpoint is more correctly modeled as an ellipse at position screenPos() with ellipseDiameters() which are independent of rotation() .

PySide2.QtGui.TouchPoint.setEllipseDiameters(dia)
Parameters

diaPySide2.QtCore.QSizeF

See also

ellipseDiameters()

PySide2.QtGui.TouchPoint.setFlags(flags)
Parameters

flagsInfoFlags

See also

flags()

PySide2.QtGui.TouchPoint.setId(id)
Parameters

id – int

See also

id()

PySide2.QtGui.TouchPoint.setLastNormalizedPos(lastNormalizedPos)
Parameters

lastNormalizedPosPySide2.QtCore.QPointF

See also

lastNormalizedPos()

PySide2.QtGui.TouchPoint.setLastPos(lastPos)
Parameters

lastPosPySide2.QtCore.QPointF

See also

lastPos()

PySide2.QtGui.TouchPoint.setLastScenePos(lastScenePos)
Parameters

lastScenePosPySide2.QtCore.QPointF

See also

lastScenePos()

PySide2.QtGui.TouchPoint.setLastScreenPos(lastScreenPos)
Parameters

lastScreenPosPySide2.QtCore.QPointF

See also

lastScreenPos()

PySide2.QtGui.TouchPoint.setNormalizedPos(normalizedPos)
Parameters

normalizedPosPySide2.QtCore.QPointF

See also

normalizedPos()

PySide2.QtGui.TouchPoint.setPos(pos)
Parameters

posPySide2.QtCore.QPointF

See also

pos()

PySide2.QtGui.TouchPoint.setPressure(pressure)
Parameters

pressure – float

See also

pressure()

PySide2.QtGui.TouchPoint.setRawScreenPositions(positions)
Parameters

positions

See also

rawScreenPositions()

PySide2.QtGui.TouchPoint.setRect(rect)
Parameters

rectPySide2.QtCore.QRectF

Note

This function is deprecated.

See also

rect()

PySide2.QtGui.TouchPoint.setRotation(angle)
Parameters

angle – float

See also

rotation()

PySide2.QtGui.TouchPoint.setScenePos(scenePos)
Parameters

scenePosPySide2.QtCore.QPointF

See also

scenePos()

PySide2.QtGui.TouchPoint.setSceneRect(sceneRect)
Parameters

sceneRectPySide2.QtCore.QRectF

Note

This function is deprecated.

See also

sceneRect()

PySide2.QtGui.TouchPoint.setScreenPos(screenPos)
Parameters

screenPosPySide2.QtCore.QPointF

See also

screenPos()

PySide2.QtGui.TouchPoint.setScreenRect(screenRect)
Parameters

screenRectPySide2.QtCore.QRectF

Note

This function is deprecated.

See also

screenRect()

PySide2.QtGui.TouchPoint.setStartNormalizedPos(startNormalizedPos)
Parameters

startNormalizedPosPySide2.QtCore.QPointF

See also

startNormalizedPos()

PySide2.QtGui.TouchPoint.setStartPos(startPos)
Parameters

startPosPySide2.QtCore.QPointF

See also

startPos()

PySide2.QtGui.TouchPoint.setStartScenePos(startScenePos)
Parameters

startScenePosPySide2.QtCore.QPointF

See also

startScenePos()

PySide2.QtGui.TouchPoint.setStartScreenPos(startScreenPos)
Parameters

startScreenPosPySide2.QtCore.QPointF

See also

startScreenPos()

PySide2.QtGui.TouchPoint.setState(state)
Parameters

stateTouchPointStates

See also

state()

PySide2.QtGui.TouchPoint.setUniqueId(uid)
Parameters

uid – int

See also

uniqueId()

PySide2.QtGui.TouchPoint.setVelocity(v)
Parameters

vPySide2.QtGui.QVector2D

See also

velocity()

PySide2.QtGui.TouchPoint.startNormalizedPos()
Return type

PySide2.QtCore.QPointF

Returns the normalized starting position of this touch point.

The coordinates are normalized to the size of the touch device, i.e. (0,0) is the top-left corner and (1,1) is the bottom-right corner.

See also

normalizedPos() lastNormalizedPos()

PySide2.QtGui.TouchPoint.startPos()
Return type

PySide2.QtCore.QPointF

Returns the starting position of this touch point, relative to the widget or QGraphicsItem that received the event.

See also

pos() lastPos()

PySide2.QtGui.TouchPoint.startScenePos()
Return type

PySide2.QtCore.QPointF

Returns the starting scene position of this touch point.

The scene position is the position in QGraphicsScene coordinates if the QTouchEvent is handled by a QGraphicsItem::touchEvent() reimplementation, and identical to the screen position for widgets.

See also

scenePos() lastScenePos()

PySide2.QtGui.TouchPoint.startScreenPos()
Return type

PySide2.QtCore.QPointF

Returns the starting screen position of this touch point.

See also

screenPos() lastScreenPos()

PySide2.QtGui.TouchPoint.state()
Return type

TouchPointState

Returns the current state of this touch point.

PySide2.QtGui.TouchPoint.swap(other)
Parameters

otherPySide2.QtGui.TouchPoint

PySide2.QtGui.TouchPoint.uniqueId()
Return type

PySide2.QtGui.QPointingDeviceUniqueId

Returns the unique ID of this touch point or token, if any.

It is normally invalid (see isValid() ), because touchscreens cannot uniquely identify fingers. But when the Token flag is set, it is expected to uniquely identify a specific token (fiducial object).

See also

flags

PySide2.QtGui.TouchPoint.velocity()
Return type

PySide2.QtGui.QVector2D

Returns a velocity vector for this touch point. The vector is in the screen’s coordinate system, using pixels per seconds for the magnitude.

Note

The returned vector is only valid if the touch device’s capabilities include Velocity .

See also

capabilities() device()