handlerPoint QML Type

An event point. 更多...

import 语句: import QtQuick

特性

详细描述

A handler-owned QML representation of a QEventPoint .

It's possible to make bindings to properties of a handler's current point or centroid 。例如:

import QtQuick 2.12
Item {
    width: 640
    height: 480
    DragHandler {
        id: handler
        target: null
    }
    Text {
        color: handler.active ? "darkgreen" : "black"
        text: handler.centroid.position.x.toFixed(1) + "," + handler.centroid.position.y.toFixed(1)
        x: handler.centroid.position.x - width / 2
        y: handler.centroid.position.y - height
    }
}
					

The point is kept up-to-date when the DragHandler is actively responding to an eventPoint ; but after the point is released, or when the current point is being handled by a different handler, position.x and position.y are 0.

注意: This is practically identical to eventPoint ; however an eventPoint is a short-lived copy of a long-lived Q_GADGET which is invalidated between gestures and reused for subsequent event deliveries. Continuous bindings to its properties are not possible, and an individual handler cannot rely on it outside the period when that point is part of an active gesture which that handler is handling. handlerPoint is a Q_GADGET that the handler owns. This allows you to make lifetime bindings to its properties.

另请参阅 SinglePointHandler::point and MultiPointHandler::centroid .

特性文档编制

[read-only] device : PointerDevice

This property holds the device that the point (and its event) came from.


[read-only] ellipseDiameters : size

This property holds the diameters of the contact patch, if the event comes from a touchpoint and the device provides this information.

A touchpoint is modeled as an elliptical area where the finger is pressed against the touchscreen. (In fact, it could also be modeled as a bitmap; but in that case we expect an elliptical bounding estimate to be fitted to the contact patch before the event is sent.) The harder the user presses, the larger the contact patch; so, these diameters provide an alternate way of detecting pressure, in case the device does not include a separate pressure sensor. The ellipse is centered on scenePosition ( position PointerHandler 's Item's local coordinates). The rotation property provides the rotation of the ellipse, if known. It is expected that if the rotation is zero, the height is the larger dimension (the major axis), because of the usual hand position, reaching upward or outward across the surface.

If the contact patch is unknown, or the device is not a touchscreen, these values will be zero.

另请参阅 QtQuick::TouchPoint::ellipseDiameters and QEventPoint::ellipseDiameters .


[read-only] id : int

The ID number of the point

During a touch gesture, from the time that the first finger is pressed until the last finger is released, each touchpoint will have a unique ID number. Likewise, if input from multiple devices occurs (for example simultaneous mouse and touch presses), all the current eventPoints from all the devices will have unique IDs.

注意: 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.

另请参阅 QEventPoint::id .


[read-only] modifiers : enumeration

Which modifier keys are currently pressed

This property holds the keyboard modifiers that were pressed at the time the event occurred.


[read-only] position : QPointF

The position within the parent Item

This is the position of the eventPoint relative to the bounds of the parent .


[read-only] pressPosition : QPointF

The pressed position within the parent Item

This is the position at which this point was pressed, relative to the bounds of the parent .


[read-only] pressedButtons : enumeration

Which mouse or stylus buttons are currently pressed

另请参阅 MouseArea::pressedButtons .


[read-only] pressure : qreal

This property tells how hard the user is pressing the stylus on a graphics tablet or the finger against a touchscreen, in the range from 0 (no measurable pressure) to 1.0 (maximum pressure which the device can measure).

It is valid only with certain tablets and touchscreens that can measure pressure. Otherwise, it will be zero.


[read-only] rotation : qreal

This property holds the rotation angle of the stylus on a graphics tablet or the contact patch of a touchpoint on a touchscreen.

It is valid only with certain tablet stylus devices and touchscreens that can measure the rotation angle. Otherwise, it will be zero.


[read-only] sceneGrabPosition : QPointF

The grabbed position within the scene

If this point has been grabbed by a Pointer Handler or an Item, it means that object has taken sole responsibility for handling the movement and the release if this point. In that case, this is the position at which the grab occurred, in the coordinate system of the 场景图形 .


[read-only] scenePosition : QPointF

The position within the scene

This is the position of the eventPoint relative to the bounds of the Qt Quick scene (typically the whole window).


[read-only] scenePressPosition : QPointF

The pressed position within the scene

This is the position at which this point was pressed, in the coordinate system of the 场景图形 .


[read-only] uniqueId : pointingDeviceUniqueId

The unique ID of the point, if any

This is normally empty, because touchscreens cannot uniquely identify fingers.

On some types of touchscreens, especially those using TUIO drivers, it's possible to use recognizable physical tokens (fiducial objects) in addition to fingers. So if this point is a touch point, and uniqueId is set, it is the identifier for such an object.

On a graphics tablet, each type of stylus or other tool often has a unique ID or serial number, which can be useful to respond in different ways to different tools.

Interpreting the contents of this ID requires knowledge of the hardware and drivers in use.

另请参阅 QTabletEvent::uniqueId and QtQuick::TouchPoint::uniqueId .


[read-only] velocity : QVector2D

A vector representing the average speed and direction of movement

This is a velocity vector pointing in the direction of movement, in logical pixels per second. It has x and y components, at least one of which will be nonzero when this point is in motion. It holds the average recent velocity: how fast and in which direction the eventPoint has been moving recently.

另请参阅 QtQuick::TouchPoint::velocity and QEventPoint::velocity .