QmlMaterial 0.1.0
Loading...
Searching...
No Matches
WheelHandler Class Reference

Handles scrolling for a Flickable and 2 attached ScrollBars. More...

#include <qml_material/kirigami/wheelhandler.h>

Signals

void wheel (KirigamiWheelEvent *wheel)
 This signal is emitted when a wheel event reaches the event filter, just before scrolling is handled.
 

Properties

QQuickItem * target
 This property holds the Qt Quick Flickable that the WheelHandler will control.
 
qreal verticalStepSize
 This property holds the vertical step size.
 
qreal horizontalStepSize
 This property holds the horizontal step size.
 
Qt::KeyboardModifiers pageScrollModifiers
 This property holds the keyboard modifiers that will be used to start page scrolling.
 
bool filterMouseEvents
 This property holds whether the WheelHandler filters mouse events like a Qt Quick Controls ScrollView would.
 
bool keyNavigationEnabled
 This property holds whether the WheelHandler handles keyboard scrolling.
 
bool blockTargetWheel
 This property holds whether the WheelHandler blocks all wheel events from reaching the Flickable.
 
bool scrollFlickableTarget
 This property holds whether the WheelHandler can use wheel events to scroll the Flickable.
 

Detailed Description

Handles scrolling for a Flickable and 2 attached ScrollBars.

WheelHandler filters events from a Flickable, a vertical ScrollBar and a horizontal ScrollBar. Wheel and KeyPress events (when keyNavigationEnabled is true) are used to scroll the Flickable. When filterMouseEvents is true, WheelHandler blocks mouse button input from reaching the Flickable and sets the interactive property of the scrollbars to false when touch input is used.

Wheel event handling behavior:

  • Pixel delta is ignored unless angle delta is not available because pixel delta scrolling is too slow. Qt Widgets doesn't use pixel delta either, so the default scroll speed should be consistent with Qt Widgets.
  • When using angle delta, scroll using the step increments defined by verticalStepSize and horizontalStepSize.
  • When one of the keyboard modifiers in pageScrollModifiers is used, scroll by pages.
  • When using a device that doesn't use 120 angle delta unit increments such as a touchpad, the verticalStepSize, horizontalStepSize and page increments (if using page scrolling) will be multiplied by angle delta / 120 to keep scrolling smooth.
  • If scrolling has happened in the last 400ms, use an internal QQuickItem stacked over the Flickable's contentItem to catch wheel events and use those wheel events to scroll, if possible. This prevents controls inside the Flickable's contentItem that allow scrolling to change the value (e.g., Sliders, SpinBoxes) from conflicting with scrolling the page.

Common usage with a Flickable:

Common usage inside of a ScrollView template:

Member Function Documentation

◆ wheel

void WheelHandler::wheel ( KirigamiWheelEvent * wheel)
signal

This signal is emitted when a wheel event reaches the event filter, just before scrolling is handled.

Accepting the wheel event in the onWheel signal handler prevents scrolling from happening.

Property Documentation

◆ blockTargetWheel

bool WheelHandler::blockTargetWheel

This property holds whether the WheelHandler blocks all wheel events from reaching the Flickable.

When this property is false, scrolling the Flickable with WheelHandler will only block an event from reaching the Flickable if the Flickable is actually scrolled by WheelHandler.

NOTE: Wheel events created by touchpad gestures with pixel deltas will always be accepted no matter what. This is because they will cause the Flickable to jump back to where scrolling started unless the events are always accepted before they reach the Flickable.

The default value is true.

◆ filterMouseEvents

bool WheelHandler::filterMouseEvents
readwrite

This property holds whether the WheelHandler filters mouse events like a Qt Quick Controls ScrollView would.

Touch events are allowed to flick the view and they make the scrollbars not interactive.

Mouse events are not allowed to flick the view and they make the scrollbars interactive.

Hover events on the scrollbars and wheel events on anything also make the scrollbars interactive when this property is set to true.

The default value is false.

Since
KDE Frameworks 5.89

◆ horizontalStepSize

qreal WheelHandler::horizontalStepSize
readwrite

This property holds the horizontal step size.

The default value is equivalent to 20 * Qt.styleHints.wheelScrollLines. This is consistent with the default increment for QScrollArea.

See also
verticalStepSize
Since
KDE Frameworks 5.89

◆ keyNavigationEnabled

bool WheelHandler::keyNavigationEnabled
readwrite

This property holds whether the WheelHandler handles keyboard scrolling.

  • Left arrow scrolls a step to the left.
  • Right arrow scrolls a step to the right.
  • Up arrow scrolls a step upwards.
  • Down arrow scrolls a step downwards.
  • PageUp scrolls to the previous page.
  • PageDown scrolls to the next page.
  • Home scrolls to the beginning.
  • End scrolls to the end.
  • When Alt is held, scroll horizontally when using PageUp, PageDown, Home or End.

The default value is false.

Since
KDE Frameworks 5.89

◆ pageScrollModifiers

Qt::KeyboardModifiers WheelHandler::pageScrollModifiers
read

This property holds the keyboard modifiers that will be used to start page scrolling.

The default value is equivalent to Qt.ControlModifier | Qt.ShiftModifier. This matches QScrollBar, which uses QAbstractSlider behavior.

Since
KDE Frameworks 5.89

◆ scrollFlickableTarget

bool WheelHandler::scrollFlickableTarget

This property holds whether the WheelHandler can use wheel events to scroll the Flickable.

The default value is true.

◆ verticalStepSize

qreal WheelHandler::verticalStepSize
readwrite

This property holds the vertical step size.

The default value is equivalent to 20 * Qt.styleHints.wheelScrollLines. This is consistent with the default increment for QScrollArea.

See also
horizontalStepSize
Since
KDE Frameworks 5.89

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