1/****************************************************************************
2**
3** Copyright (C) 2017 The Qt Company Ltd.
4** Contact: http://www.qt.io/licensing/
5**
6** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
7**
8** $QT_BEGIN_LICENSE:LGPL3$
9** Commercial License Usage
10** Licensees holding valid commercial Qt licenses may use this file in
11** accordance with the commercial license agreement provided with the
12** Software or, alternatively, in accordance with the terms contained in
13** a written agreement between you and The Qt Company. For licensing terms
14** and conditions see http://www.qt.io/terms-conditions. For further
15** information use the contact form at http://www.qt.io/contact-us.
16**
17** GNU Lesser General Public License Usage
18** Alternatively, this file may be used under the terms of the GNU Lesser
19** General Public License version 3 as published by the Free Software
20** Foundation and appearing in the file LICENSE.LGPLv3 included in the
21** packaging of this file. Please review the following information to
22** ensure the GNU Lesser General Public License version 3 requirements
23** will be met: https://www.gnu.org/licenses/lgpl.html.
24**
25** GNU General Public License Usage
26** Alternatively, this file may be used under the terms of the GNU
27** General Public License version 2.0 or later as published by the Free
28** Software Foundation and appearing in the file LICENSE.GPL included in
29** the packaging of this file. Please review the following information to
30** ensure the GNU General Public License version 2.0 requirements will be
31** met: http://www.gnu.org/licenses/gpl-2.0.html.
32**
33** $QT_END_LICENSE$
34**
35****************************************************************************/
36
37#ifndef QQUICKDIAL_P_H
38#define QQUICKDIAL_P_H
39
40//
41// W A R N I N G
42// -------------
43//
44// This file is not part of the Qt API. It exists purely as an
45// implementation detail. This header file may change from version to
46// version without notice, or even be removed.
47//
48// We mean it.
49//
50
51#include <QtCore/qvariant.h>
52#include <QtQml/qqmlcomponent.h>
53#include <QtQuickTemplates2/private/qquickcontrol_p.h>
54
55QT_BEGIN_NAMESPACE
56
57class QQuickDialAttached;
58class QQuickDialPrivate;
59
60class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickDial : public QQuickControl
61{
62 Q_OBJECT
63 Q_PROPERTY(qreal from READ from WRITE setFrom NOTIFY fromChanged FINAL)
64 Q_PROPERTY(qreal to READ to WRITE setTo NOTIFY toChanged FINAL)
65 Q_PROPERTY(qreal value READ value WRITE setValue NOTIFY valueChanged FINAL)
66 Q_PROPERTY(qreal position READ position NOTIFY positionChanged FINAL)
67 Q_PROPERTY(qreal angle READ angle NOTIFY angleChanged FINAL)
68 Q_PROPERTY(qreal stepSize READ stepSize WRITE setStepSize NOTIFY stepSizeChanged FINAL)
69 Q_PROPERTY(SnapMode snapMode READ snapMode WRITE setSnapMode NOTIFY snapModeChanged FINAL)
70 Q_PROPERTY(bool wrap READ wrap WRITE setWrap NOTIFY wrapChanged FINAL)
71 Q_PROPERTY(bool pressed READ isPressed NOTIFY pressedChanged FINAL)
72 Q_PROPERTY(QQuickItem *handle READ handle WRITE setHandle NOTIFY handleChanged FINAL)
73 // 2.2 (Qt 5.9)
74 Q_PROPERTY(bool live READ live WRITE setLive NOTIFY liveChanged FINAL REVISION 2)
75 // 2.5 (Qt 5.12)
76 Q_PROPERTY(InputMode inputMode READ inputMode WRITE setInputMode NOTIFY inputModeChanged FINAL REVISION 5)
77 Q_CLASSINFO("DeferredPropertyNames", "background,handle")
78
79public:
80 explicit QQuickDial(QQuickItem *parent = nullptr);
81
82 qreal from() const;
83 void setFrom(qreal from);
84
85 qreal to() const;
86 void setTo(qreal to);
87
88 qreal value() const;
89 void setValue(qreal value);
90
91 qreal position() const;
92
93 qreal angle() const;
94
95 qreal stepSize() const;
96 void setStepSize(qreal step);
97
98 enum SnapMode {
99 NoSnap,
100 SnapAlways,
101 SnapOnRelease
102 };
103 Q_ENUM(SnapMode)
104
105 SnapMode snapMode() const;
106 void setSnapMode(SnapMode mode);
107
108 enum InputMode {
109 Circular,
110 Horizontal,
111 Vertical,
112 };
113 Q_ENUM(InputMode)
114
115 bool wrap() const;
116 void setWrap(bool wrap);
117
118 bool isPressed() const;
119 void setPressed(bool pressed);
120
121 QQuickItem *handle() const;
122 void setHandle(QQuickItem *handle);
123
124 // 2.2 (Qt 5.9)
125 bool live() const;
126 void setLive(bool live);
127
128 // 2.5 (Qt 5.12)
129 InputMode inputMode() const;
130 void setInputMode(InputMode mode);
131
132public Q_SLOTS:
133 void increase();
134 void decrease();
135
136Q_SIGNALS:
137 void fromChanged();
138 void toChanged();
139 void valueChanged();
140 void positionChanged();
141 void angleChanged();
142 void stepSizeChanged();
143 void snapModeChanged();
144 void wrapChanged();
145 void pressedChanged();
146 void handleChanged();
147 // 2.2 (Qt 5.9)
148 Q_REVISION(2) void moved();
149 Q_REVISION(2) void liveChanged();
150 // 2.5 (Qt 5.12)
151 Q_REVISION(5) void inputModeChanged();
152
153protected:
154 void keyPressEvent(QKeyEvent *event) override;
155 void keyReleaseEvent(QKeyEvent *event) override;
156 void mousePressEvent(QMouseEvent *event) override;
157#if QT_CONFIG(quicktemplates2_multitouch)
158 void touchEvent(QTouchEvent *event) override;
159#endif
160#if QT_CONFIG(wheelevent)
161 void wheelEvent(QWheelEvent *event) override;
162#endif
163
164 void mirrorChange() override;
165 void componentComplete() override;
166
167#if QT_CONFIG(accessibility)
168 void accessibilityActiveChanged(bool active) override;
169 QAccessible::Role accessibleRole() const override;
170#endif
171
172private:
173 Q_DISABLE_COPY(QQuickDial)
174 Q_DECLARE_PRIVATE(QQuickDial)
175};
176
177QT_END_NAMESPACE
178
179QML_DECLARE_TYPE(QQuickDial)
180
181#endif // QQUICKDIAL_P_H
182

source code of qtquickcontrols2/src/quicktemplates2/qquickdial_p.h