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 | |
4 | #ifndef QQUICKWHEELHANDLER_H |
5 | #define QQUICKWHEELHANDLER_H |
6 | |
7 | // |
8 | // W A R N I N G |
9 | // ------------- |
10 | // |
11 | // This file is not part of the Qt API. It exists purely as an |
12 | // implementation detail. This header file may change from version to |
13 | // version without notice, or even be removed. |
14 | // |
15 | // We mean it. |
16 | // |
17 | |
18 | #include <QtGui/qevent.h> |
19 | #include <QtQuick/qquickitem.h> |
20 | |
21 | #include "qquicksinglepointhandler_p.h" |
22 | |
23 | QT_BEGIN_NAMESPACE |
24 | |
25 | class QQuickWheelEvent; |
26 | class QQuickWheelHandlerPrivate; |
27 | |
28 | class Q_QUICK_PRIVATE_EXPORT QQuickWheelHandler : public QQuickSinglePointHandler |
29 | { |
30 | Q_OBJECT |
31 | Q_PROPERTY(Qt::Orientation orientation READ orientation WRITE setOrientation NOTIFY orientationChanged FINAL) |
32 | Q_PROPERTY(bool invertible READ isInvertible WRITE setInvertible NOTIFY invertibleChanged FINAL) |
33 | Q_PROPERTY(qreal activeTimeout READ activeTimeout WRITE setActiveTimeout NOTIFY activeTimeoutChanged FINAL) |
34 | Q_PROPERTY(qreal rotation READ rotation WRITE setRotation NOTIFY rotationChanged FINAL) |
35 | Q_PROPERTY(qreal rotationScale READ rotationScale WRITE setRotationScale NOTIFY rotationScaleChanged FINAL) |
36 | Q_PROPERTY(QString property READ property WRITE setProperty NOTIFY propertyChanged FINAL) |
37 | Q_PROPERTY(qreal targetScaleMultiplier READ targetScaleMultiplier WRITE setTargetScaleMultiplier NOTIFY targetScaleMultiplierChanged FINAL) |
38 | Q_PROPERTY(bool targetTransformAroundCursor READ isTargetTransformAroundCursor WRITE setTargetTransformAroundCursor NOTIFY targetTransformAroundCursorChanged FINAL) |
39 | Q_PROPERTY(bool blocking READ isBlocking WRITE setBlocking NOTIFY blockingChanged REVISION(6, 3) FINAL) |
40 | |
41 | QML_NAMED_ELEMENT(WheelHandler) |
42 | QML_ADDED_IN_VERSION(2, 14) |
43 | |
44 | public: |
45 | explicit QQuickWheelHandler(QQuickItem *parent = nullptr); |
46 | |
47 | Qt::Orientation orientation() const; |
48 | void setOrientation(Qt::Orientation orientation); |
49 | |
50 | bool isInvertible() const; |
51 | void setInvertible(bool invertible); |
52 | |
53 | qreal activeTimeout() const; |
54 | void setActiveTimeout(qreal timeout); |
55 | |
56 | qreal rotation() const; |
57 | void setRotation(qreal rotation); |
58 | |
59 | qreal rotationScale() const; |
60 | void setRotationScale(qreal rotationScale); |
61 | |
62 | QString property() const; |
63 | void setProperty(const QString &name); |
64 | |
65 | qreal targetScaleMultiplier() const; |
66 | void setTargetScaleMultiplier(qreal targetScaleMultiplier); |
67 | |
68 | bool isTargetTransformAroundCursor() const; |
69 | void setTargetTransformAroundCursor(bool ttac); |
70 | |
71 | bool isBlocking() const; |
72 | void setBlocking(bool blocking); |
73 | |
74 | Q_SIGNALS: |
75 | void wheel(QQuickWheelEvent *event); |
76 | |
77 | void orientationChanged(); |
78 | void invertibleChanged(); |
79 | void activeTimeoutChanged(); |
80 | void rotationChanged(); |
81 | void rotationScaleChanged(); |
82 | void propertyChanged(); |
83 | void targetScaleMultiplierChanged(); |
84 | void targetTransformAroundCursorChanged(); |
85 | Q_REVISION(6, 3) void blockingChanged(); |
86 | |
87 | protected: |
88 | bool wantsPointerEvent(QPointerEvent *event) override; |
89 | void handleEventPoint(QPointerEvent *event, QEventPoint &point) override; |
90 | void onTargetChanged(QQuickItem *oldTarget) override; |
91 | void onActiveChanged() override; |
92 | void timerEvent(QTimerEvent *event) override; |
93 | |
94 | Q_DECLARE_PRIVATE(QQuickWheelHandler) |
95 | }; |
96 | |
97 | QT_END_NAMESPACE |
98 | |
99 | #endif // QQUICKWHEELHANDLER_H |
100 |