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
qquickslider_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 QQUICKSLIDER_P_H
6#define QQUICKSLIDER_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 <QtQuickTemplates2/private/qquickcontrol_p.h>
20
21QT_BEGIN_NAMESPACE
22
23class QQuickSliderPrivate;
24
25class Q_QUICKTEMPLATES2_EXPORT QQuickSlider : public QQuickControl
26{
27 Q_OBJECT
28 Q_PROPERTY(qreal from READ from WRITE setFrom NOTIFY fromChanged FINAL)
29 Q_PROPERTY(qreal to READ to WRITE setTo NOTIFY toChanged FINAL)
30 Q_PROPERTY(qreal value READ value WRITE setValue NOTIFY valueChanged FINAL)
31 Q_PROPERTY(qreal position READ position NOTIFY positionChanged FINAL)
32 Q_PROPERTY(qreal visualPosition READ visualPosition NOTIFY visualPositionChanged FINAL)
33 Q_PROPERTY(qreal stepSize READ stepSize WRITE setStepSize NOTIFY stepSizeChanged FINAL)
34 Q_PROPERTY(SnapMode snapMode READ snapMode WRITE setSnapMode NOTIFY snapModeChanged FINAL)
35 Q_PROPERTY(bool pressed READ isPressed WRITE setPressed NOTIFY pressedChanged FINAL)
36 Q_PROPERTY(Qt::Orientation orientation READ orientation WRITE setOrientation NOTIFY orientationChanged FINAL)
37 Q_PROPERTY(QQuickItem *handle READ handle WRITE setHandle NOTIFY handleChanged FINAL)
38 Q_PROPERTY(bool live READ live WRITE setLive NOTIFY liveChanged FINAL REVISION(2, 2))
39 // 2.3 (Qt 5.10)
40 Q_PROPERTY(bool horizontal READ isHorizontal NOTIFY orientationChanged FINAL REVISION(2, 3))
41 Q_PROPERTY(bool vertical READ isVertical NOTIFY orientationChanged FINAL REVISION(2, 3))
42 // 2.5 (Qt 5.12)
43 Q_PROPERTY(qreal touchDragThreshold READ touchDragThreshold WRITE setTouchDragThreshold RESET resetTouchDragThreshold NOTIFY touchDragThresholdChanged FINAL REVISION(2, 5))
44 Q_PROPERTY(qreal implicitHandleWidth READ implicitHandleWidth NOTIFY implicitHandleWidthChanged FINAL REVISION(2, 5))
45 Q_PROPERTY(qreal implicitHandleHeight READ implicitHandleHeight NOTIFY implicitHandleHeightChanged FINAL REVISION(2, 5))
46 Q_CLASSINFO("DeferredPropertyNames", "background,handle")
47 QML_NAMED_ELEMENT(Slider)
48 QML_ADDED_IN_VERSION(2, 0)
49
50public:
51 explicit QQuickSlider(QQuickItem *parent = nullptr);
52 ~QQuickSlider();
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 qreal visualPosition() const;
65
66 qreal stepSize() const;
67 void setStepSize(qreal step);
68
69 enum SnapMode {
70 NoSnap,
71 SnapAlways,
72 SnapOnRelease
73 };
74 Q_ENUM(SnapMode)
75
76 SnapMode snapMode() const;
77 void setSnapMode(SnapMode mode);
78
79 bool isPressed() const;
80 void setPressed(bool pressed);
81
82 Qt::Orientation orientation() const;
83 void setOrientation(Qt::Orientation orientation);
84
85 QQuickItem *handle() const;
86 void setHandle(QQuickItem *handle);
87
88 // 2.1 (Qt 5.8)
89 Q_REVISION(2, 1) Q_INVOKABLE qreal valueAt(qreal position) const;
90
91 // 2.2 (Qt 5.9)
92 bool live() const;
93 void setLive(bool live);
94
95 // 2.3 (Qt 5.10)
96 bool isHorizontal() const;
97 bool isVertical() const;
98
99 // 2.5 (Qt 5.12)
100 qreal touchDragThreshold() const;
101 void setTouchDragThreshold(qreal touchDragThreshold);
102 void resetTouchDragThreshold();
103
104 qreal implicitHandleWidth() const;
105 qreal implicitHandleHeight() const;
106
107public Q_SLOTS:
108 void increase();
109 void decrease();
110
111Q_SIGNALS:
112 void fromChanged();
113 void toChanged();
114 void valueChanged();
115 void positionChanged();
116 void visualPositionChanged();
117 void stepSizeChanged();
118 void snapModeChanged();
119 void pressedChanged();
120 void orientationChanged();
121 void handleChanged();
122 // 2.2 (Qt 5.9)
123 Q_REVISION(2, 2) void moved();
124 Q_REVISION(2, 2) void liveChanged();
125 // 2.5 (Qt 5.12)
126 Q_REVISION(2, 5) void touchDragThresholdChanged();
127 Q_REVISION(2, 5) void implicitHandleWidthChanged();
128 Q_REVISION(2, 5) void implicitHandleHeightChanged();
129
130protected:
131 void keyPressEvent(QKeyEvent *event) override;
132 void keyReleaseEvent(QKeyEvent *event) override;
133 void mousePressEvent(QMouseEvent *event) override;
134#if QT_CONFIG(quicktemplates2_multitouch)
135 void touchEvent(QTouchEvent *event) override;
136#endif
137#if QT_CONFIG(wheelevent)
138 void wheelEvent(QWheelEvent *event) override;
139#endif
140
141 void mirrorChange() override;
142 void componentComplete() override;
143
144#if QT_CONFIG(accessibility)
145 void accessibilityActiveChanged(bool active) override;
146 QAccessible::Role accessibleRole() const override;
147#endif
148
149private:
150 Q_DISABLE_COPY(QQuickSlider)
151 Q_DECLARE_PRIVATE(QQuickSlider)
152};
153
154QT_END_NAMESPACE
155
156#endif // QQUICKSLIDER_P_H