PointerScrollEvent QML Type

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

Import Statement: import QtQuick 2.14

Properties

Detailed Description

See also WheelHandler.

Property Documentation

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.

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.


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

Returns whether the delta values delivered with the event are inverted.

Normally, a vertical wheel will produce a PointerScrollEvent with positive delta values if the top of the wheel is rotating away from the hand operating it. Similarly, a horizontal wheel movement will produce a PointerScrollEvent with positive delta values if the top of the wheel is moved to the left.

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 values.

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


[read-only] modifiers : int

This property holds the keyboard modifier keys that were pressed immediately before the event occurred.

It contains a bitwise combination of the following flags:

ConstantDescription
Qt.NoModifierNo modifier key is pressed.
Qt.ShiftModifierA Shift key on the keyboard is pressed.
Qt.ControlModifierA Ctrl key on the keyboard is pressed.
Qt.AltModifierAn Alt key on the keyboard is pressed.
Qt.MetaModifierA Meta key on the keyboard is pressed.
Qt.KeypadModifierA keypad button is pressed.

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 should be used instead.


© 2020 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.