WheelEvent QML Type

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

import 語句: import QtQuick 2.7

特性

詳細描述

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

另請參閱 MouseArea .

特性文檔編製

accepted : bool

設置 accepted to true prevents the wheel event from being propagated to items below this item.

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

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:

  • Qt.LeftButton
  • Qt.RightButton
  • Qt.MiddleButton

inverted : int

返迴隨事件交付的增量值是否反轉。

通常,垂直滾輪會産生 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 始終返迴 false。

modifiers : int

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

It contains a bitwise combination of:

  • Qt.NoModifier - No modifier key is pressed.
  • Qt.ShiftModifier - A Shift key on the keyboard is pressed.
  • Qt.ControlModifier - A Ctrl key on the keyboard is pressed.
  • Qt.AltModifier - An Alt key on the keyboard is pressed.
  • Qt.MetaModifier - A Meta key on the keyboard is pressed.
  • Qt.KeypadModifier - A keypad button is pressed.

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

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

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 cordinate of this property holds the delta in horizontal and vertical orientation. The value should be used directly to scroll content on screen.

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

x : real

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

y : real

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