PointerScrollEvent QML Type

Provides information about a scrolling event, such as from a mouse wheel. 更多...

import 语句: import QtQuick 2.15

特性

详细描述

另请参阅 WheelHandler .

特性文档编制

angleDelta : point

This property holds the distance that the wheel is rotated in wheel degrees. The x and y cordinate of this property holds the delta in horizontal and vertical orientation.

A positive value indicates that the wheel was rotated up/right; a negative value indicates that the wheel was rotated down/left.

大多数鼠标类型以 15 度步幅为单位工作,在这种情况下,增量值是 120 的倍增 (即:120 单位 *1/8 = 15 度)。

buttons : int

This property holds the mouse buttons pressed when the wheel event was generated.

It contains a bitwise combination of:

[read-only] device : PointerDevice

This property holds the device that generated the event.

hasAngleDelta : bool

Returns whether the angleDelta property has a non-null value.

hasPixelDelta : bool

Returns whether the pixelDelta property has a non-null value.

inverted : bool

返回随事件交付的增量值是否反转。

通常,垂直滚轮会产生 PointerScrollEvent 具有正增量值若滚轮顶部旋转离开操作它的手。同样,水平滚轮运动会产生 PointerScrollEvent 具有正增量值若滚轮顶部向左移动。

However, on some platforms this is configurable, so that the same operations described above will produce negative delta values (but with the same magnitude). In a QML component (such as a tumbler or a slider) where it is appropriate to synchronize the movement or rotation of an item with the direction of the wheel, regardless of the system settings, the wheel event handler can use the inverted property to decide whether to negate the angleDelta or pixelDelta 值。

注意: Many platforms provide no such information. On such platforms, inverted always returns false.

[read-only] modifiers : int

此特性保持 keyboard modifier keys that were pressed immediately before the event occurred.

It contains a bitwise combination of the following flags:

常量 描述
Qt.NoModifier 未按下修饰符键。
Qt.ShiftModifier 按下键盘 Shift 键。
Qt.ControlModifier 按下键盘 Ctrl 键。
Qt.AltModifier 按下键盘 Alt 键。
Qt.MetaModifier 按下键盘 Meta 键。
Qt.KeypadModifier 按下 Keypad (小键盘) 按钮。

For example, to react to a Shift key + Left mouse button click:

Item {
    TapHandler {
        onTapped: {
            if ((event.button == Qt.LeftButton) && (event.modifiers & Qt.ShiftModifier))
                doSomething();
        }
    }
}
					

pixelDelta : point

This property holds the delta in screen pixels and is available in platforms that have high-resolution trackpads, such as macOS. The x and y coordinates of this property hold the delta in horizontal and vertical orientation. The value should be used directly to scroll content on screen.

For platforms without high-resolution touchpad support, pixelDelta will always be (0,0), and angleDelta 应该被使用以取而代之。