Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qquickwheelhandler_p.h
Go to the documentation of this file.
1// Copyright (C) 2019 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3// Qt-Security score:significant reason:default
4
5#ifndef QQUICKWHEELHANDLER_H
6#define QQUICKWHEELHANDLER_H
7
8//
9// W A R N I N G
10// -------------
11//
12// This file is not part of the Qt API. It exists purely as an
13// implementation detail. This header file may change from version to
14// version without notice, or even be removed.
15//
16// We mean it.
17//
18
19#include <QtGui/qevent.h>
20#include <QtQuick/qquickitem.h>
21
23
25
26class QQuickWheelEvent;
27class QQuickWheelHandlerPrivate;
28
29class Q_QUICK_EXPORT QQuickWheelHandler : public QQuickSinglePointHandler
30{
31 Q_OBJECT
32 Q_PROPERTY(Qt::Orientation orientation READ orientation WRITE setOrientation NOTIFY orientationChanged)
33 Q_PROPERTY(bool invertible READ isInvertible WRITE setInvertible NOTIFY invertibleChanged)
34 Q_PROPERTY(qreal activeTimeout READ activeTimeout WRITE setActiveTimeout NOTIFY activeTimeoutChanged)
35 Q_PROPERTY(qreal rotation READ rotation WRITE setRotation NOTIFY rotationChanged)
36 Q_PROPERTY(qreal rotationScale READ rotationScale WRITE setRotationScale NOTIFY rotationScaleChanged)
37 Q_PROPERTY(QString property READ property WRITE setProperty NOTIFY propertyChanged)
38 Q_PROPERTY(qreal targetScaleMultiplier READ targetScaleMultiplier WRITE setTargetScaleMultiplier NOTIFY targetScaleMultiplierChanged)
39 Q_PROPERTY(bool targetTransformAroundCursor READ isTargetTransformAroundCursor WRITE setTargetTransformAroundCursor NOTIFY targetTransformAroundCursorChanged)
40 Q_PROPERTY(bool blocking READ isBlocking WRITE setBlocking NOTIFY blockingChanged REVISION(6, 3))
41
42 QML_NAMED_ELEMENT(WheelHandler)
43 QML_ADDED_IN_VERSION(2, 14)
44
45public:
46 explicit QQuickWheelHandler(QQuickItem *parent = nullptr);
47
48 Qt::Orientation orientation() const;
49 void setOrientation(Qt::Orientation orientation);
50
51 bool isInvertible() const;
52 void setInvertible(bool invertible);
53
54 qreal activeTimeout() const;
55 void setActiveTimeout(qreal timeout);
56
57 qreal rotation() const;
58 void setRotation(qreal rotation);
59
60 qreal rotationScale() const;
61 void setRotationScale(qreal rotationScale);
62
63 QString property() const;
64 void setProperty(const QString &name);
65
66 qreal targetScaleMultiplier() const;
67 void setTargetScaleMultiplier(qreal targetScaleMultiplier);
68
69 bool isTargetTransformAroundCursor() const;
70 void setTargetTransformAroundCursor(bool ttac);
71
72 bool isBlocking() const;
73 void setBlocking(bool blocking);
74
75Q_SIGNALS:
76 void wheel(QQuickWheelEvent *event);
77
78 void orientationChanged();
79 void invertibleChanged();
80 void activeTimeoutChanged();
81 void rotationChanged();
82 void rotationScaleChanged();
83 void propertyChanged();
84 void targetScaleMultiplierChanged();
85 void targetTransformAroundCursorChanged();
86 Q_REVISION(6, 3) void blockingChanged();
87
88protected:
89 bool wantsPointerEvent(QPointerEvent *event) override;
90 void handleEventPoint(QPointerEvent *event, QEventPoint &point) override;
91 void onTargetChanged(QQuickItem *oldTarget) override;
92 void onActiveChanged() override;
93 void timerEvent(QTimerEvent *event) override;
94
95 Q_DECLARE_PRIVATE(QQuickWheelHandler)
96};
97
98QT_END_NAMESPACE
99
100#endif // QQUICKWHEELHANDLER_H