Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
QQuickWheelEvent Class Reference

\qmlproperty real QtQuick::MouseEvent::x \qmlproperty real QtQuick::MouseEvent::y More...

+ Collaboration diagram for QQuickWheelEvent:

Detailed Description

\qmlproperty real QtQuick::MouseEvent::x \qmlproperty real QtQuick::MouseEvent::y

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

\qmlproperty bool QtQuick::MouseEvent::accepted

Setting accepted to true prevents the mouse event from being propagated to items below this item.

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

\qmlproperty enumeration QtQuick::MouseEvent::button

This property holds the button that caused the event. It can be one of: \list

\qmlproperty bool QtQuick::MouseEvent::wasHeld

This property is true if the mouse button has been held pressed longer than the threshold (800ms).

\qmlproperty int QtQuick::MouseEvent::buttons

This property holds the mouse buttons pressed when the event was generated. For mouse move events, this is all buttons that are pressed down. For mouse press and double click events this includes the button that caused the event. For mouse release events this excludes the button that caused the event.

It contains a bitwise combination of: \list

\qmlproperty int QtQuick::MouseEvent::modifiers

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

It contains a bitwise combination of: \list

For example, to react to a Shift key + Left mouse button click: \qml MouseArea { onClicked: (mouse)=> { if ((mouse.button == Qt.LeftButton) && (mouse.modifiers & Qt.ShiftModifier)) doSomething(); } } \endqml

\qmlproperty int QtQuick::MouseEvent::source

Since
5.7
Deprecated
[6.2] Use \l {Qt Quick Input Handlers}{input handlers} with \l {PointerDeviceHandler::acceptedDevices}{acceptedDevices} set.

This property holds the source of the mouse event.

The mouse event source can be used to distinguish between genuine and artificial mouse events. When using other pointing devices such as touchscreens and graphics tablets, if the application does not make use of the actual touch or tablet events, mouse events may be synthesized by the operating system or by Qt itself.

The value can be one of:

\list

For example, to react only to events which come from an actual mouse: \qml MouseArea { onPressed: (mouse)=> { if (mouse.source !== Qt.MouseEventNotSynthesized) mouse.accepted = false }

onClicked: doSomething() } \endqml

If the handler for the press event rejects the event, it will be propagated further, and then another Item underneath can handle synthesized events from touchscreens. For example, if a Flickable is used underneath (and the MouseArea is not a child of the Flickable), it can be useful for the MouseArea to handle genuine mouse events in one way, while allowing touch events to fall through to the Flickable underneath, so that the ability to flick on a touchscreen is retained. In that case the ability to drag the Flickable via mouse would be lost, but it does not prevent Flickable from receiving mouse wheel events.

\qmlproperty int QtQuick::MouseEvent::flags

Since
5.11

This property holds the flags that provide additional information about the mouse event.

\list

\qmltype WheelEvent \instantiates QQuickWheelEvent \inqmlmodule QtQuick

Provides information about a mouse wheel event.

The position of the mouse can be found via the \l x and \l y properties.

See also
WheelHandler, MouseArea

The documentation for this class was generated from the following file: