本页内容

eventPoint QML Type

QEventPoint 的 QML 等效代码。更多内容...

Import Statement: import QtQuick
In C++: QEventPoint

详细说明

eventPoint 是 `QEventPoint` 在 QML 中的值类型表示。它与 `QEventPoint` 具有相同的属性。

提供以下属性:

该状态支持以下值:

常量描述
EventPoint.Unknown未知状态;与 Qt.TouchPointUnknownState 相同
EventPoint.Stationary事件点未移动;与 Qt.TouchPointStationary 相同
EventPoint.Pressed触摸点或按钮被按下;与 Qt.TouchPointPressed 相同
EventPoint.Updated事件点已更新;与 Qt.TouchPointMoved 相同
EventPoint.Released触摸点或按钮已被释放;与 Qt.TouchPointReleased 相同

States 类型是QFlags<State> 的 typedef。它存储 State 值的“或”组合。另请参阅QEventPoint::States

TapHandler {
    gesturePolicy: TapHandler.ReleaseWithinBounds // exclusive grab on press
    onGrabChanged:
        (transition, eventPoint) => {
            switch (transition) {
                case PointerDevice.GrabExclusive:
                    console.log("took exclusive grab of point", eventPoint.id,
                                "on", eventPoint.device.name)
                    break
                case PointerDevice.UngrabExclusive:
                    console.log("gave up exclusive grab of point", eventPoint.id,
                                "on", eventPoint.device.name)
                    break
                case PointerDevice.CancelGrabExclusive:
                    console.log("exclusive grab of point", eventPoint.id,
                                "on", eventPoint.device.name, "has been cancelled")
                    break
            }

            switch (eventPoint.state) {
                case EventPoint.Pressed:
                    console.log("on press @", eventPoint.position);
                    break
                case EventPoint.Updated:
                    console.log("on update @", eventPoint.position);
                    break
                case EventPoint.Released:
                    console.log("on release @", eventPoint.position);
                    break
                default:
                    console.log(eventPoint.position, "state", eventPoint.state)
                    break
            }
        }
}

另请参阅 ` handlerPoint`。

© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.