WheelEvent QML Type

Provides information about a mouse wheel event. 更多...

import 语句: import QtQuick

特性

详细描述

The position of the mouse can be found via the x and y 特性。

另请参阅 WheelHandler and MouseArea .

特性文档编制

x : real [read-only]

y : real [read-only]

These properties hold the coordinates of the position supplied by the wheel event.

另请参阅 QWheelEvent::position ().

accepted : bool

设置 accepted to true prevents the wheel event from being propagated to items below the receiving item or handler.

Generally, if the item acts on the wheel event, it should be accepted so that items lower in the stacking order do not also respond to the same event.

另请参阅 QWheelEvent::accepted .

angleDelta : point [read-only]

This property holds the relative amount that the wheel was rotated, in eighths of a degree. The x and y coordinates of this property hold the delta in horizontal and vertical orientations, respectively.

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

Most mouse types work in steps of 15 degrees, in which case the delta value is a multiple of 120 ; i.e., 120 units * 1/8 = 15 degrees .

另请参阅 QWheelEvent::angleDelta ().

buttons : int [read-only]

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

It contains a bitwise combination of:

另请参阅 QWheelEvent::buttons ().

inverted : bool [read-only]

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

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

However, on some platforms this is configurable, so that the same operations described above will produce negative delta values (but with the same magnitude). For instance, 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 值。

注意: 很多平台不提供这种信息。在这种平台 inverted always returns false .

另请参阅 QWheelEvent::inverted ().

modifiers : int [read-only]

This property holds the keyboard modifier flags that existed immediately before the event occurred.

It contains a bitwise combination of:

For example, to react to a Control key pressed during the wheel event:

WheelHandler {
    onWheel: (wheel)=> {
        if (wheel.modifiers & Qt.ControlModifier) {
            adjustZoom(wheel.angleDelta.y / 120);
        }
    }
}
					

另请参阅 QWheelEvent::modifiers ().

pixelDelta : point [read-only]

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 orientations, respectively. The values can be used directly to scroll content on screen.

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

另请参阅 QWheelEvent::pixelDelta ().