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
qquickdial_p.h
Go to the documentation of this file.
1// Copyright (C) 2017 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 QQUICKDIAL_P_H
6#define QQUICKDIAL_P_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 <QtCore/qvariant.h>
20#include <QtQml/qqmlcomponent.h>
21#include <QtQuickTemplates2/private/qquickcontrol_p.h>
22
23QT_BEGIN_NAMESPACE
24
25class QQuickDialAttached;
27
28class Q_QUICKTEMPLATES2_EXPORT QQuickDial : public QQuickControl
29{
30 Q_OBJECT
31 Q_PROPERTY(qreal from READ from WRITE setFrom NOTIFY fromChanged FINAL)
32 Q_PROPERTY(qreal to READ to WRITE setTo NOTIFY toChanged FINAL)
33 Q_PROPERTY(qreal value READ value WRITE setValue NOTIFY valueChanged FINAL)
34 Q_PROPERTY(qreal position READ position NOTIFY positionChanged FINAL)
35 Q_PROPERTY(qreal angle READ angle NOTIFY angleChanged FINAL)
36 Q_PROPERTY(qreal startAngle READ startAngle WRITE setStartAngle NOTIFY startAngleChanged FINAL REVISION(6, 6))
37 Q_PROPERTY(qreal endAngle READ endAngle WRITE setEndAngle NOTIFY endAngleChanged FINAL REVISION(6, 6))
38 Q_PROPERTY(qreal stepSize READ stepSize WRITE setStepSize NOTIFY stepSizeChanged FINAL)
39 Q_PROPERTY(SnapMode snapMode READ snapMode WRITE setSnapMode NOTIFY snapModeChanged FINAL)
40 Q_PROPERTY(bool wrap READ wrap WRITE setWrap NOTIFY wrapChanged FINAL)
41 Q_PROPERTY(bool pressed READ isPressed NOTIFY pressedChanged FINAL)
42 Q_PROPERTY(QQuickItem *handle READ handle WRITE setHandle NOTIFY handleChanged FINAL)
43 // 2.2 (Qt 5.9)
44 Q_PROPERTY(bool live READ live WRITE setLive NOTIFY liveChanged FINAL REVISION(2, 2))
45 // 2.5 (Qt 5.12)
46 Q_PROPERTY(InputMode inputMode READ inputMode WRITE setInputMode NOTIFY inputModeChanged FINAL REVISION(2, 5))
47 Q_CLASSINFO("DeferredPropertyNames", "background,handle")
48 QML_NAMED_ELEMENT(Dial)
49 QML_ADDED_IN_VERSION(2, 0)
50
51public:
52 explicit QQuickDial(QQuickItem *parent = nullptr);
53
54 qreal from() const;
55 void setFrom(qreal from);
56
57 qreal to() const;
58 void setTo(qreal to);
59
60 qreal value() const;
61 void setValue(qreal value);
62
63 qreal position() const;
64
65 qreal angle() const;
66
67 qreal stepSize() const;
68 void setStepSize(qreal step);
69
70 qreal startAngle() const;
71 void setStartAngle(qreal startAngle);
72
73 qreal endAngle() const;
74 void setEndAngle(qreal endAngle);
75
76 enum SnapMode {
77 NoSnap,
78 SnapAlways,
79 SnapOnRelease
80 };
81 Q_ENUM(SnapMode)
82
83 SnapMode snapMode() const;
84 void setSnapMode(SnapMode mode);
85
86 enum InputMode {
87 Circular,
88 Horizontal,
89 Vertical,
90 };
91 Q_ENUM(InputMode)
92
93 enum WrapDirection {
94 Clockwise,
95 CounterClockwise
96 };
97 Q_ENUM(WrapDirection)
98
99 bool wrap() const;
100 void setWrap(bool wrap);
101
102 bool isPressed() const;
103 void setPressed(bool pressed);
104
105 QQuickItem *handle() const;
106 void setHandle(QQuickItem *handle);
107
108 // 2.2 (Qt 5.9)
109 bool live() const;
110 void setLive(bool live);
111
112 // 2.5 (Qt 5.12)
113 InputMode inputMode() const;
114 void setInputMode(InputMode mode);
115
116public Q_SLOTS:
117 void increase();
118 void decrease();
119
120Q_SIGNALS:
121 void fromChanged();
122 void toChanged();
123 void valueChanged();
124 void positionChanged();
125 void angleChanged();
126 void stepSizeChanged();
127 void snapModeChanged();
128 void wrapChanged();
129 void pressedChanged();
130 void handleChanged();
131 // 2.2 (Qt 5.9)
132 Q_REVISION(2, 2) void moved();
133 Q_REVISION(2, 2) void liveChanged();
134 // 2.5 (Qt 5.12)
135 Q_REVISION(2, 5) void inputModeChanged();
136 Q_REVISION(6, 6) void startAngleChanged();
137 Q_REVISION(6, 6) void endAngleChanged();
138 Q_REVISION(6, 6) void wrapped(WrapDirection);
139
140protected:
141 void keyPressEvent(QKeyEvent *event) override;
142 void keyReleaseEvent(QKeyEvent *event) override;
143 void mousePressEvent(QMouseEvent *event) override;
144#if QT_CONFIG(quicktemplates2_multitouch)
145 void touchEvent(QTouchEvent *event) override;
146#endif
147#if QT_CONFIG(wheelevent)
148 void wheelEvent(QWheelEvent *event) override;
149#endif
150
151 void mirrorChange() override;
152 void componentComplete() override;
153
154#if QT_CONFIG(accessibility)
155 void accessibilityActiveChanged(bool active) override;
156 QAccessible::Role accessibleRole() const override;
157#endif
158
159private:
160 Q_DISABLE_COPY(QQuickDial)
161 Q_DECLARE_PRIVATE(QQuickDial)
162};
163
164QT_END_NAMESPACE
165
166#endif // QQUICKDIAL_P_H
void executeHandle(bool complete=false)
bool handlePress(const QPointF &point, ulong timestamp) override
bool handleRelease(const QPointF &point, ulong timestamp) override
void maybeEmitWrapAround(qreal pos)
qreal linearPositionAt(const QPointF &point) const
void handleUngrab() override
qreal snapPosition(qreal position) const
bool isHorizontalOrVertical() const
qreal positionAt(const QPointF &point) const
bool isLargeChange(qreal proposedPosition) const
QQuickDeferredPointer< QQuickItem > handle
void setPosition(qreal position)
qreal circularPositionAt(const QPointF &point) const
void updateAllValuesAreInteger()
bool handleMove(const QPointF &point, ulong timestamp) override
#define M_PI
Definition qmath.h:200
static const qreal defaultEndAngle
static const qreal defaultStartAngle
static bool areRepresentableAsInteger(Real... numbers)