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
QQuickWheelHandler Class Reference

#include <qquickwheelhandler_p.h>

+ Inheritance diagram for QQuickWheelHandler:
+ Collaboration diagram for QQuickWheelHandler:

Signals

void wheel (QQuickWheelEvent *event)
 
void orientationChanged ()
 
void invertibleChanged ()
 
void activeTimeoutChanged ()
 
void rotationChanged ()
 
void rotationScaleChanged ()
 
void propertyChanged ()
 
void targetScaleMultiplierChanged ()
 
void targetTransformAroundCursorChanged ()
 
 Q_REVISION (6, 3) void blockingChanged()
 
- Signals inherited from QQuickSinglePointHandler
void pointChanged ()
 
- Signals inherited from QQuickPointerDeviceHandler
void acceptedDevicesChanged ()
 
void acceptedPointerTypesChanged ()
 
void acceptedButtonsChanged ()
 
void acceptedModifiersChanged ()
 
- Signals inherited from QQuickPointerHandler
void enabledChanged ()
 
void activeChanged ()
 
void targetChanged ()
 
void marginChanged ()
 
 Q_REVISION (2, 15) void dragThresholdChanged()
 
void grabChanged (QPointingDevice::GrabTransition transition, QEventPoint point)
 
void grabPermissionChanged ()
 
void canceled (QEventPoint point)
 
 Q_REVISION (6, 3) void parentChanged()
 
- Signals inherited from QObject
void destroyed (QObject *=nullptr)
 This signal is emitted immediately before the object obj is destroyed, after any instances of QPointer have been notified, and cannot be blocked.
 
void objectNameChanged (const QString &objectName, QPrivateSignal)
 This signal is emitted after the object's name has been changed.
 

Public Member Functions

 QQuickWheelHandler (QQuickItem *parent=nullptr)
 \qmltype WheelHandler \instantiates QQuickWheelHandler \inherits SinglePointHandler \inqmlmodule QtQuick
 
Qt::Orientation orientation () const
 \qmlproperty enumeration QtQuick::WheelHandler::orientation
 
void setOrientation (Qt::Orientation orientation)
 
bool isInvertible () const
 \qmlproperty bool QtQuick::WheelHandler::invertible
 
void setInvertible (bool invertible)
 
qreal activeTimeout () const
 \qmlproperty real QtQuick::WheelHandler::activeTimeout
 
void setActiveTimeout (qreal timeout)
 
qreal rotation () const
 \qmlproperty real QtQuick::WheelHandler::rotation
 
void setRotation (qreal rotation)
 
qreal rotationScale () const
 \qmlproperty real QtQuick::WheelHandler::rotationScale
 
void setRotationScale (qreal rotationScale)
 
QString property () const
 \qmlproperty string QtQuick::WheelHandler::property
 
void setProperty (const QString &name)
 
qreal targetScaleMultiplier () const
 \qmlproperty real QtQuick::WheelHandler::targetScaleMultiplier
 
void setTargetScaleMultiplier (qreal targetScaleMultiplier)
 
bool isTargetTransformAroundCursor () const
 \qmlproperty bool QtQuick::WheelHandler::targetTransformAroundCursor
 
void setTargetTransformAroundCursor (bool ttac)
 
bool isBlocking () const
 \qmlproperty bool QtQuick::WheelHandler::blocking
 
void setBlocking (bool blocking)
 
- Public Member Functions inherited from QQuickSinglePointHandler
 QQuickSinglePointHandler (QQuickItem *parent=nullptr)
 \qmltype SinglePointHandler \qmlabstract \preliminary \instantiates QQuickSinglePointHandler \inherits PointerDeviceHandler \inqmlmodule QtQuick
 
QQuickHandlerPoint point () const
 
- Public Member Functions inherited from QQuickPointerDeviceHandler
 QQuickPointerDeviceHandler (QQuickItem *parent=nullptr)
 \qmltype PointerDeviceHandler \qmlabstract
 
QInputDevice::DeviceTypes acceptedDevices () const
 
QPointingDevice::PointerTypes acceptedPointerTypes () const
 
Qt::MouseButtons acceptedButtons () const
 \qmlproperty flags QtQuick::PointerDeviceHandler::acceptedButtons
 
Qt::KeyboardModifiers acceptedModifiers () const
 
- Public Member Functions inherited from QQuickPointerHandler
 QQuickPointerHandler (QQuickItem *parent=nullptr)
 \qmltype PointerHandler \qmlabstract
 
 ~QQuickPointerHandler ()
 
bool enabled () const
 \qmlproperty bool QtQuick::PointerHandler::enabled
 
void setEnabled (bool enabled)
 
bool active () const
 \readonly \qmlproperty bool QtQuick::PointerHandler::active
 
QQuickItemtarget () const
 \qmlproperty Item QtQuick::PointerHandler::target
 
void setTarget (QQuickItem *target)
 
QQuickItemparentItem () const
 \qmlproperty Item QtQuick::PointerHandler::parent
 
void setParentItem (QQuickItem *p)
 
void handlePointerEvent (QPointerEvent *event)
 
GrabPermissions grabPermissions () const
 \qmlproperty flags QtQuick::PointerHandler::grabPermissions
 
void setGrabPermissions (GrabPermissions grabPermissions)
 
qreal margin () const
 \qmlproperty real PointerHandler::margin
 
void setMargin (qreal pointDistanceThreshold)
 
int dragThreshold () const
 \qmlproperty int PointerHandler::dragThreshold
 
void setDragThreshold (int t)
 
void resetDragThreshold ()
 
- Public Member Functions inherited from QObject
Q_INVOKABLE QObject (QObject *parent=nullptr)
 Constructs an object with parent object parent.
 
virtual ~QObject ()
 Destroys the object, deleting all its child objects.
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 Filters events if this object has been installed as an event filter for the watched object.
 
QString objectName () const
 
Q_WEAK_OVERLOAD void setObjectName (const QString &name)
 Sets the object's name to name.
 
void setObjectName (QAnyStringView name)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
QBindable< QStringbindableObjectName ()
 
bool isWidgetType () const
 Returns true if the object is a widget; otherwise returns false.
 
bool isWindowType () const
 Returns true if the object is a window; otherwise returns false.
 
bool isQuickItemType () const
 Returns true if the object is a QQuickItem; otherwise returns false.
 
bool signalsBlocked () const noexcept
 Returns true if signals are blocked; otherwise returns false.
 
bool blockSignals (bool b) noexcept
 If block is true, signals emitted by this object are blocked (i.e., emitting a signal will not invoke anything connected to it).
 
QThreadthread () const
 Returns the thread in which the object lives.
 
bool moveToThread (QThread *thread QT6_DECL_NEW_OVERLOAD_TAIL)
 Changes the thread affinity for this object and its children and returns true on success.
 
int startTimer (int interval, Qt::TimerType timerType=Qt::CoarseTimer)
 This is an overloaded function that will start a timer of type timerType and a timeout of interval milliseconds.
 
int startTimer (std::chrono::nanoseconds time, Qt::TimerType timerType=Qt::CoarseTimer)
 
void killTimer (int id)
 Kills the timer with timer identifier, id.
 
void killTimer (Qt::TimerId id)
 
template<typename T >
findChild (QAnyStringView aName, Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
 Returns the child of this object that can be cast into type T and that is called name, or \nullptr if there is no such object.
 
template<typename T >
QList< T > findChildren (QAnyStringView aName, Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
 Returns all children of this object with the given name that can be cast to type T, or an empty list if there are no such objects.
 
template<typename T >
findChild (Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
template<typename T >
QList< T > findChildren (Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
const QObjectListchildren () const
 Returns a list of child objects.
 
void setParent (QObject *parent)
 Makes the object a child of parent.
 
void installEventFilter (QObject *filterObj)
 Installs an event filter filterObj on this object.
 
void removeEventFilter (QObject *obj)
 Removes an event filter object obj from this object.
 
QMetaObject::Connection connect (const QObject *sender, const char *signal, const char *member, Qt::ConnectionType type=Qt::AutoConnection) const
 
bool disconnect (const char *signal=nullptr, const QObject *receiver=nullptr, const char *member=nullptr) const
 
bool disconnect (const QObject *receiver, const char *member=nullptr) const
 
void dumpObjectTree () const
 Dumps a tree of children to the debug output.
 
void dumpObjectInfo () const
 Dumps information about signal connections, etc.
 
bool setProperty (const char *name, const QVariant &value)
 Sets the value of the object's name property to value.
 
bool setProperty (const char *name, QVariant &&value)
 
QVariant property (const char *name) const
 Returns the value of the object's name property.
 
QList< QByteArraydynamicPropertyNames () const
 
QBindingStoragebindingStorage ()
 
const QBindingStoragebindingStorage () const
 
QObjectparent () const
 Returns a pointer to the parent object.
 
bool inherits (const char *classname) const
 Returns true if this object is an instance of a class that inherits className or a QObject subclass that inherits className; otherwise returns false.
 
- Public Member Functions inherited from QQmlParserStatus
 QQmlParserStatus ()
 
virtual ~QQmlParserStatus ()
 

Protected Member Functions

bool wantsPointerEvent (QPointerEvent *event) override
 It is the responsibility of this function to decide whether the event could be relevant at all to this handler, as a preliminary check.
 
void handleEventPoint (QPointerEvent *event, QEventPoint &point) override
 
void onTargetChanged (QQuickItem *oldTarget) override
 
void onActiveChanged () override
 
void timerEvent (QTimerEvent *event) override
 This event handler can be reimplemented in a subclass to receive timer events for the object.
 
- Protected Member Functions inherited from QQuickSinglePointHandler
 QQuickSinglePointHandler (QQuickSinglePointHandlerPrivate &dd, QQuickItem *parent)
 
void handlePointerEventImpl (QPointerEvent *event) override
 This function can be overridden to implement whatever behavior a specific subclass is intended to have: \list.
 
QEventPointcurrentPoint (QPointerEvent *ev)
 
void onGrabChanged (QQuickPointerHandler *grabber, QPointingDevice::GrabTransition transition, QPointerEvent *event, QEventPoint &point) override
 Notification that the grab has changed in some way which is relevant to this handler.
 
void setIgnoreAdditionalPoints (bool v=true)
 
void moveTarget (QPointF pos, QEventPoint &point)
 
void setPointId (int id)
 
- Protected Member Functions inherited from QQuickPointerDeviceHandler
 QQuickPointerDeviceHandler (QQuickPointerDeviceHandlerPrivate &dd, QQuickItem *parent=nullptr)
 
- Protected Member Functions inherited from QQuickPointerHandler
 QQuickPointerHandler (QQuickPointerHandlerPrivate &dd, QQuickItem *parent)
 
void classBegin () override
 Overridden only because QQmlParserStatus requires it.
 
void componentComplete () override
 Overridden from QQmlParserStatus to ensure that parentItem() sets its cursor if this handler's \l cursorShape property has been set.
 
bool event (QEvent *) override
 
QPointerEventcurrentEvent ()
 
virtual bool wantsEventPoint (const QPointerEvent *event, const QEventPoint &point)
 Returns true if the given point (as part of event) could be relevant at all to this handler, as a preliminary check.
 
void setActive (bool active)
 
virtual bool canGrab (QPointerEvent *event, const QEventPoint &point)
 Check whether it's OK to take an exclusive grab of the point.
 
virtual bool approveGrabTransition (QPointerEvent *event, const QEventPoint &point, QObject *proposedGrabber)
 Check this handler's rules to see if \l proposedGrabber will be allowed to take the exclusive grab.
 
void setPassiveGrab (QPointerEvent *event, const QEventPoint &point, bool grab=true)
 Acquire or give up a passive grab of the given point, according to the grab state.
 
bool setExclusiveGrab (QPointerEvent *ev, const QEventPoint &point, bool grab=true)
 Acquire or give up the exclusive grab of the given point, according to the grab state, and subject to the rules: canGrab(), and the rule not to relinquish another handler's grab.
 
void cancelAllGrabs (QPointerEvent *event, QEventPoint &point)
 Cancel any existing grab of the given point.
 
QPointF eventPos (const QEventPoint &point) const
 
bool parentContains (const QEventPoint &point) const
 Returns true if margin() > 0 and point is within the margin beyond QQuickItem::boundingRect(), or else returns QQuickItem::contains() QEventPoint::position() effectively (because parentContains(scenePosition) calls QQuickItem::mapFromScene()).
 
bool parentContains (const QPointF &scenePosition) const
 Returns true if scenePosition is within the margin() beyond QQuickItem::boundingRect() (if margin > 0), or parentItem() contains scenePosition according to QQuickItem::contains().
 
- Protected Member Functions inherited from QObject
QObjectsender () const
 Returns a pointer to the object that sent the signal, if called in a slot activated by a signal; otherwise it returns \nullptr.
 
int senderSignalIndex () const
 
int receivers (const char *signal) const
 Returns the number of receivers connected to the signal.
 
bool isSignalConnected (const QMetaMethod &signal) const
 
virtual void childEvent (QChildEvent *event)
 This event handler can be reimplemented in a subclass to receive child events.
 
virtual void customEvent (QEvent *event)
 This event handler can be reimplemented in a subclass to receive custom events.
 
virtual void connectNotify (const QMetaMethod &signal)
 
virtual void disconnectNotify (const QMetaMethod &signal)
 
 QObject (QObjectPrivate &dd, QObject *parent=nullptr)
 

Properties

Qt::Orientation orientation
 
bool invertible
 
qreal activeTimeout
 
qreal rotation
 
qreal rotationScale
 
QString property
 
qreal targetScaleMultiplier
 
bool targetTransformAroundCursor
 
bool blocking
 
- Properties inherited from QQuickSinglePointHandler
QQuickHandlerPoint point
 
- Properties inherited from QQuickPointerDeviceHandler
QInputDevice::DeviceTypes acceptedDevices
 
QPointingDevice::PointerTypes acceptedPointerTypes
 
Qt::MouseButtons acceptedButtons
 
Qt::KeyboardModifiers acceptedModifiers
 
- Properties inherited from QQuickPointerHandler
bool enabled
 
bool active
 
QQuickItemtarget
 
QQuickItemparent
 
GrabPermissions grabPermissions
 
qreal margin
 
int dragThreshold
 
- Properties inherited from QObject
QString objectName
 the name of this object
 

Additional Inherited Members

- Public Types inherited from QQuickPointerHandler
enum  GrabPermission {
  TakeOverForbidden = 0x0 , CanTakeOverFromHandlersOfSameType = 0x01 , CanTakeOverFromHandlersOfDifferentType = 0x02 , CanTakeOverFromItems = 0x04 ,
  CanTakeOverFromAnything = 0x0F , ApprovesTakeOverByHandlersOfSameType = 0x10 , ApprovesTakeOverByHandlersOfDifferentType = 0x20 , ApprovesTakeOverByItems = 0x40 ,
  ApprovesCancellation = 0x80 , ApprovesTakeOverByAnything = 0xF0
}
 
- Public Slots inherited from QQuickPointerDeviceHandler
void setAcceptedDevices (QInputDevice::DeviceTypes acceptedDevices)
 \qmlproperty flags PointerDeviceHandler::acceptedDevices
 
void setAcceptedPointerTypes (QPointingDevice::PointerTypes acceptedPointerTypes)
 \qmlproperty flags PointerDeviceHandler::acceptedPointerTypes
 
void setAcceptedButtons (Qt::MouseButtons buttons)
 
void setAcceptedModifiers (Qt::KeyboardModifiers acceptedModifiers)
 \qmlproperty flags PointerDeviceHandler::acceptedModifiers
 
- Public Slots inherited from QObject
void deleteLater ()
 \threadsafe
 
- Static Public Member Functions inherited from QObject
static QMetaObject::Connection connect (const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
 \threadsafe
 
static QMetaObject::Connection connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type=Qt::AutoConnection)
 
template<typename Func1 , typename Func2 >
static QMetaObject::Connection connect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const typename QtPrivate::ContextTypeForFunctor< Func2 >::ContextType *context, Func2 &&slot, Qt::ConnectionType type=Qt::AutoConnection)
 
template<typename Func1 , typename Func2 >
static QMetaObject::Connection connect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, Func2 &&slot)
 
static bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *member)
 \threadsafe
 
static bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &member)
 
static bool disconnect (const QMetaObject::Connection &)
 Disconnect a connection.
 
template<typename Func1 , typename Func2 >
static bool disconnect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const typename QtPrivate::FunctionPointer< Func2 >::Object *receiver, Func2 slot)
 
template<typename Func1 >
static bool disconnect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const QObject *receiver, void **zero)
 
- Protected Attributes inherited from QObject
QScopedPointer< QObjectDatad_ptr
 

Detailed Description

Definition at line 28 of file qquickwheelhandler_p.h.

Constructor & Destructor Documentation

◆ QQuickWheelHandler()

QT_BEGIN_NAMESPACE QQuickWheelHandler::QQuickWheelHandler ( QQuickItem * parent = nullptr)
explicit

\qmltype WheelHandler \instantiates QQuickWheelHandler \inherits SinglePointHandler \inqmlmodule QtQuick

Handler for the mouse wheel.

WheelHandler is a handler that is used to interactively manipulate some numeric property of an Item as the user rotates the mouse wheel. Like other Input Handlers, by default it manipulates its \l {PointerHandler::target} {target}. Declare \l property to control which target property will be manipulated:

import QtQuick
Rectangle {
width: 170; height: 120
color: "green"; antialiasing: true
WheelHandler {
property: "rotation"
onWheel: (event)=> console.log("rotation", event.angleDelta.y,
"scaled", rotation, "@", point.position,
"=>", parent.rotation)
}
}

\l BoundaryRule is quite useful in combination with WheelHandler (as well as with other Input Handlers) to declare the allowed range of values that the target property can have. For example it is possible to implement scrolling using a combination of WheelHandler and \l DragHandler to manipulate the scrollable Item's \l{QQuickItem::y}{y} property when the user rotates the wheel or drags the item on a touchscreen, and \l BoundaryRule to limit the range of motion from the top to the bottom:

import QtQuick
import Qt.labs.animation
Item {
width: 320; height: 480
Flow {
id: content
width: parent.width
spacing: 2; padding: 2
WheelHandler {
orientation: Qt.Vertical
property: "y"
rotationScale: 15
acceptedDevices: PointerDevice.Mouse | PointerDevice.TouchPad
onActiveChanged: if (!active) ybr.returnToBounds()
}
DragHandler {
xAxis.enabled: false
onActiveChanged: if (!active) ybr.returnToBounds()
}
BoundaryRule on y {
id: ybr
minimum: content.parent.height - content.height
maximum: 0
minimumOvershoot: 400; maximumOvershoot: 400
overshootFilter: BoundaryRule.Peak
}
Repeater {
model: 1000
Rectangle { color: "gray"; width: 10 + Math.random() * 100; height: 15 }
}
}
}

Alternatively, if \l property is not set or \l target is null, WheelHandler will not automatically manipulate anything; but the \l rotation property can be used in a binding to manipulate another property, or you can implement onWheel and handle the wheel event directly.

WheelHandler handles only a rotating mouse wheel by default; this can be changed by setting acceptedDevices.

See also
MouseArea, Flickable, {Qt Quick Examples - Pointer Handlers}

Definition at line 52 of file qquickwheelhandler.cpp.

References QInputDevice::Mouse.

Member Function Documentation

◆ activeTimeout()

qreal QQuickWheelHandler::activeTimeout ( ) const

\qmlproperty real QtQuick::WheelHandler::activeTimeout

The amount of time in seconds after which the \l active property will revert to false if no more wheel events are received. The default is 0.1 (100 ms).

When WheelHandler handles events that contain \l {Qt::ScrollPhase}{scroll phase} information, such as events from some touchpads, the \l active property will become false as soon as an event with phase \l Qt::ScrollEnd is received; in that case the timeout is not necessary. But a conventional mouse with a wheel does not provide a scroll phase: the mouse cannot detect when the user has decided to stop scrolling, so the \l active property transitions to false after this much time has elapsed.

See also
QWheelEvent::phase()

Definition at line 130 of file qquickwheelhandler.cpp.

References d.

◆ activeTimeoutChanged

void QQuickWheelHandler::activeTimeoutChanged ( )
signal

Referenced by setActiveTimeout().

+ Here is the caller graph for this function:

◆ handleEventPoint()

◆ invertibleChanged

void QQuickWheelHandler::invertibleChanged ( )
signal

Referenced by setInvertible().

+ Here is the caller graph for this function:

◆ isBlocking()

bool QQuickWheelHandler::isBlocking ( ) const

\qmlproperty bool QtQuick::WheelHandler::blocking

Since
6.3

Whether this handler prevents other items or handlers behind it from handling the same wheel event. This property is true by default.

Definition at line 329 of file qquickwheelhandler.cpp.

References d.

◆ isInvertible()

bool QQuickWheelHandler::isInvertible ( ) const

\qmlproperty bool QtQuick::WheelHandler::invertible

Whether or not to reverse the direction of property change if \l QWheelEvent::inverted is true. The default is true.

If the operating system has a "natural scrolling" setting that causes scrolling to be in the same direction as the finger movement, then if this property is set to true, and WheelHandler is directly setting a property on \l target, the direction of movement will correspond to the system setting. If this property is set to false, it will invert the \l rotation so that the direction of motion is always the same as the direction of finger movement.

Definition at line 96 of file qquickwheelhandler.cpp.

References d.

◆ isTargetTransformAroundCursor()

bool QQuickWheelHandler::isTargetTransformAroundCursor ( ) const

\qmlproperty bool QtQuick::WheelHandler::targetTransformAroundCursor

Whether the \l target should automatically be repositioned in such a way that it is transformed around the mouse cursor position while the \l property is adjusted. The default is true.

If \l property is set to "rotation" and \l targetTransformAroundCursor is true, then as the wheel is rotated, the \l target item will rotate in place around the mouse cursor position. If targetTransformAroundCursor is false, it will rotate around its \l{QQuickItem::transformOrigin}{transformOrigin} instead.

Definition at line 306 of file qquickwheelhandler.cpp.

References d.

◆ onActiveChanged()

void QQuickWheelHandler::onActiveChanged ( )
overrideprotectedvirtual

Reimplemented from QQuickPointerHandler.

Definition at line 477 of file qquickwheelhandler.cpp.

References QQuickPointerHandler::active, and d.

◆ onTargetChanged()

void QQuickWheelHandler::onTargetChanged ( QQuickItem * oldTarget)
overrideprotectedvirtual

Reimplemented from QQuickPointerHandler.

Definition at line 470 of file qquickwheelhandler.cpp.

References d, and Q_UNUSED.

◆ orientation()

Qt::Orientation QQuickWheelHandler::orientation ( ) const

\qmlproperty enumeration QtQuick::WheelHandler::orientation

Which wheel to react to. The default is Qt.Vertical.

Not every mouse has a Horizontal wheel; sometimes it is emulated by tilting the wheel sideways. A touchpad can usually generate both vertical and horizontal wheel events.

Definition at line 67 of file qquickwheelhandler.cpp.

References d.

◆ orientationChanged

void QQuickWheelHandler::orientationChanged ( )
signal

Referenced by setOrientation().

+ Here is the caller graph for this function:

◆ property()

QString QQuickWheelHandler::property ( ) const

\qmlproperty string QtQuick::WheelHandler::property

The property to be modified on the \l target when the mouse wheel is rotated.

The default is no property (empty string). When no target property is being automatically modified, you can use bindings to react to mouse wheel rotation in arbitrary ways.

You can use the mouse wheel to adjust any numeric property. For example if property is set to x, the \l target will move horizontally as the wheel is rotated. The following properties have special behavior:

\value scale \l{QQuickItem::scale}{scale} will be modified in a non-linear fashion as described under \l targetScaleMultiplier. If \l targetTransformAroundCursor is true, the \l{QQuickItem::x}{x} and \l{QQuickItem::y}{y} properties will be simultaneously adjusted so that the user will effectively zoom into or out of the point under the mouse cursor. \value rotation \l{QQuickItem::rotation}{rotation} will be set to \l rotation. If \l targetTransformAroundCursor is true, the l{QQuickItem::x}{x} and \l{QQuickItem::y}{y} properties will be simultaneously adjusted so that the user will effectively rotate the item around the point under the mouse cursor.

The adjustment of the given target property is always scaled by \l rotationScale.

Definition at line 242 of file qquickwheelhandler.cpp.

References d.

◆ propertyChanged

void QQuickWheelHandler::propertyChanged ( )
signal

Referenced by setProperty().

+ Here is the caller graph for this function:

◆ Q_REVISION

QQuickWheelHandler::Q_REVISION ( 6 ,
3  )
signal

◆ rotation()

qreal QQuickWheelHandler::rotation ( ) const

\qmlproperty real QtQuick::WheelHandler::rotation

The angle through which the mouse wheel has been rotated since the last time this property was set, in wheel degrees.

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

A basic mouse click-wheel works in steps of 15 degrees.

The default is 0 at startup. It can be programmatically set to any value at any time. The value will be adjusted from there as the user rotates the mouse wheel.

See also
orientation

Definition at line 168 of file qquickwheelhandler.cpp.

References d.

◆ rotationChanged

void QQuickWheelHandler::rotationChanged ( )
signal

Referenced by handleEventPoint(), and setRotation().

+ Here is the caller graph for this function:

◆ rotationScale()

qreal QQuickWheelHandler::rotationScale ( ) const

\qmlproperty real QtQuick::WheelHandler::rotationScale

The scaling to be applied to the \l rotation property, and to the \l property on the \l target item, if any. The default is 1, such that \l rotation will be in units of degrees of rotation. It can be set to a negative number to invert the effect of the direction of mouse wheel rotation.

Definition at line 193 of file qquickwheelhandler.cpp.

References d.

◆ rotationScaleChanged

void QQuickWheelHandler::rotationScaleChanged ( )
signal

Referenced by setRotationScale().

+ Here is the caller graph for this function:

◆ setActiveTimeout()

void QQuickWheelHandler::setActiveTimeout ( qreal timeout)

Definition at line 136 of file qquickwheelhandler.cpp.

References activeTimeoutChanged(), d, emit, qFuzzyCompare(), and qWarning.

+ Here is the call graph for this function:

◆ setBlocking()

void QQuickWheelHandler::setBlocking ( bool blocking)

Definition at line 335 of file qquickwheelhandler.cpp.

References blocking, d, and emit.

◆ setInvertible()

void QQuickWheelHandler::setInvertible ( bool invertible)

Definition at line 102 of file qquickwheelhandler.cpp.

References d, emit, invertible, and invertibleChanged().

+ Here is the call graph for this function:

◆ setOrientation()

void QQuickWheelHandler::setOrientation ( Qt::Orientation orientation)

Definition at line 73 of file qquickwheelhandler.cpp.

References d, emit, orientation, and orientationChanged().

+ Here is the call graph for this function:

◆ setProperty()

void QQuickWheelHandler::setProperty ( const QString & name)

Definition at line 248 of file qquickwheelhandler.cpp.

References d, emit, and propertyChanged().

+ Here is the call graph for this function:

◆ setRotation()

void QQuickWheelHandler::setRotation ( qreal rotation)

Definition at line 174 of file qquickwheelhandler.cpp.

References d, emit, qFuzzyCompare(), rotation, and rotationChanged().

+ Here is the call graph for this function:

◆ setRotationScale()

void QQuickWheelHandler::setRotationScale ( qreal rotationScale)

Definition at line 199 of file qquickwheelhandler.cpp.

References d, emit, qFuzzyCompare(), qFuzzyIsNull(), qWarning, rotationScale, and rotationScaleChanged().

+ Here is the call graph for this function:

◆ setTargetScaleMultiplier()

void QQuickWheelHandler::setTargetScaleMultiplier ( qreal targetScaleMultiplier)

Definition at line 283 of file qquickwheelhandler.cpp.

References d, emit, qFuzzyCompare(), targetScaleMultiplier, and targetScaleMultiplierChanged().

+ Here is the call graph for this function:

◆ setTargetTransformAroundCursor()

void QQuickWheelHandler::setTargetTransformAroundCursor ( bool ttac)

Definition at line 312 of file qquickwheelhandler.cpp.

References d, emit, and targetTransformAroundCursorChanged().

+ Here is the call graph for this function:

◆ targetScaleMultiplier()

qreal QQuickWheelHandler::targetScaleMultiplier ( ) const

\qmlproperty real QtQuick::WheelHandler::targetScaleMultiplier

The amount by which the \l target \l{QQuickItem::scale}{scale} is to be multiplied whenever the \l rotation changes by 15 degrees. This is relevant only when \l property is "scale".

The scale will be multiplied by targetScaleMultiplier \sup {angleDelta * rotationScale / 15}. The default is 2 \sup {1/3}, which means that if \l rotationScale is left at its default value, and the mouse wheel is rotated by one "click" (15 degrees), the \l target will be scaled by approximately 1.25; after three "clicks" its size will be doubled or halved, depending on the direction that the wheel is rotated. If you want to make it double or halve with every 2 clicks of the wheel, set this to 2 \sup {1/2} (1.4142). If you want to make it scale the opposite way as the wheel is rotated, set rotationScale to a negative value.

Definition at line 277 of file qquickwheelhandler.cpp.

References d.

◆ targetScaleMultiplierChanged

void QQuickWheelHandler::targetScaleMultiplierChanged ( )
signal

Referenced by setTargetScaleMultiplier().

+ Here is the caller graph for this function:

◆ targetTransformAroundCursorChanged

void QQuickWheelHandler::targetTransformAroundCursorChanged ( )
signal

Referenced by setTargetTransformAroundCursor().

+ Here is the caller graph for this function:

◆ timerEvent()

void QQuickWheelHandler::timerEvent ( QTimerEvent * event)
overrideprotectedvirtual

This event handler can be reimplemented in a subclass to receive timer events for the object.

QChronoTimer provides higher-level interfaces to the timer functionality, and also more general information about timers. The timer event is passed in the event parameter.

See also
startTimer(), killTimer(), event()

Reimplemented from QObject.

Definition at line 484 of file qquickwheelhandler.cpp.

References d, QObject::objectName, qCDebug, and QQuickPointerHandler::setActive().

+ Here is the call graph for this function:

◆ wantsPointerEvent()

bool QQuickWheelHandler::wantsPointerEvent ( QPointerEvent * event)
overrideprotectedvirtual

It is the responsibility of this function to decide whether the event could be relevant at all to this handler, as a preliminary check.

Returns true if this handler would like handlePointerEventImpl() to be called. If it returns false, the handler will be deactivated: setActive(false) will be called, and any remaining exclusive grab will be relinquished, as a fail-safe.

If you override this function, you should call the immediate parent class implementation (and return false if it returns false); that in turn calls its parent class implementation, and so on. QQuickSinglePointHandler::wantsPointerEvent() and QQuickMultiPointHandler::wantsPointerEvent() call wantsEventPoint(), which is also virtual. You usually can get the behavior you want by subclassing the appropriate handler type, overriding QQuickSinglePointHandler::handleEventPoint() or handlePointerEventImpl(), and perhaps overriding wantsEventPoint() if needed.

See also
wantsEventPoint(), QQuickPointerDeviceHandler::wantsPointerEvent(), QQuickMultiPointHandler::wantsPointerEvent(), QQuickSinglePointHandler::wantsPointerEvent()

Reimplemented from QQuickSinglePointHandler.

Definition at line 345 of file qquickwheelhandler.cpp.

References QQuickPointerDeviceHandler::acceptedDevices, QQuickPointerHandler::active, Qt::Horizontal, QQuickHandlerPoint::id, Qt::MouseEventNotSynthesized, orientation, QQuickPointerHandler::parentContains(), QQuickSinglePointHandler::point, QQuickSinglePointHandler::setPointId(), QInputDevice::TouchPad, Qt::Vertical, QQuickPointerHandler::wantsEventPoint(), QQuickPointerDeviceHandler::wantsPointerEvent(), and QEvent::Wheel.

+ Here is the call graph for this function:

◆ wheel

void QQuickWheelHandler::wheel ( QQuickWheelEvent * event)
signal

Referenced by handleEventPoint().

+ Here is the caller graph for this function:

Property Documentation

◆ activeTimeout

qreal QQuickWheelHandler::activeTimeout
readwrite

Definition at line 33 of file qquickwheelhandler_p.h.

◆ blocking

bool QQuickWheelHandler::blocking
readwrite

Definition at line 39 of file qquickwheelhandler_p.h.

Referenced by setBlocking().

◆ invertible

bool QQuickWheelHandler::invertible
readwrite

Definition at line 32 of file qquickwheelhandler_p.h.

Referenced by setInvertible().

◆ orientation

Qt::Orientation QQuickWheelHandler::orientation
readwrite

Definition at line 31 of file qquickwheelhandler_p.h.

Referenced by handleEventPoint(), setOrientation(), and wantsPointerEvent().

◆ property

QString QQuickWheelHandler::property
readwrite

Definition at line 36 of file qquickwheelhandler_p.h.

◆ rotation

qreal QQuickWheelHandler::rotation
readwrite

Definition at line 34 of file qquickwheelhandler_p.h.

Referenced by setRotation().

◆ rotationScale

qreal QQuickWheelHandler::rotationScale
readwrite

Definition at line 35 of file qquickwheelhandler_p.h.

Referenced by setRotationScale().

◆ targetScaleMultiplier

qreal QQuickWheelHandler::targetScaleMultiplier
readwrite

Definition at line 37 of file qquickwheelhandler_p.h.

Referenced by setTargetScaleMultiplier().

◆ targetTransformAroundCursor

bool QQuickWheelHandler::targetTransformAroundCursor
readwrite

Definition at line 38 of file qquickwheelhandler_p.h.


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