Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qquickrangeslider_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
4#ifndef QQUICKRANGESLIDER_P_H
5#define QQUICKRANGESLIDER_P_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 <QtQuickTemplates2/private/qquickcontrol_p.h>
19
21
24
25class Q_QUICKTEMPLATES2_EXPORT QQuickRangeSlider : public QQuickControl
26{
28 Q_PROPERTY(qreal from READ from WRITE setFrom NOTIFY fromChanged FINAL)
29 Q_PROPERTY(qreal to READ to WRITE setTo NOTIFY toChanged FINAL)
31 Q_PROPERTY(QQuickRangeSliderNode *second READ second CONSTANT FINAL)
32 Q_PROPERTY(qreal stepSize READ stepSize WRITE setStepSize NOTIFY stepSizeChanged FINAL)
33 Q_PROPERTY(SnapMode snapMode READ snapMode WRITE setSnapMode NOTIFY snapModeChanged FINAL)
34 Q_PROPERTY(Qt::Orientation orientation READ orientation WRITE setOrientation NOTIFY orientationChanged FINAL)
35 // 2.2 (Qt 5.9)
36 Q_PROPERTY(bool live READ live WRITE setLive NOTIFY liveChanged FINAL REVISION(2, 2))
37 Q_PROPERTY(bool horizontal READ isHorizontal NOTIFY orientationChanged FINAL REVISION(2, 3))
38 // 2.3 (Qt 5.10)
39 Q_PROPERTY(bool vertical READ isVertical NOTIFY orientationChanged FINAL REVISION(2, 3))
40 // 2.5 (Qt 5.12)
41 Q_PROPERTY(qreal touchDragThreshold READ touchDragThreshold WRITE setTouchDragThreshold RESET resetTouchDragThreshold NOTIFY touchDragThresholdChanged FINAL REVISION(2, 5))
42 QML_NAMED_ELEMENT(RangeSlider)
44
45public:
46 explicit QQuickRangeSlider(QQuickItem *parent = nullptr);
48
49 qreal from() const;
50 void setFrom(qreal from);
51
52 qreal to() const;
53 void setTo(qreal to);
54
56 QQuickRangeSliderNode *second() const;
57
58 qreal stepSize() const;
59 void setStepSize(qreal step);
60
61 enum SnapMode {
64 SnapOnRelease
65 };
66 Q_ENUM(SnapMode)
67
68 SnapMode snapMode() const;
69 void setSnapMode(SnapMode mode);
70
71 Qt::Orientation orientation() const;
72 void setOrientation(Qt::Orientation orientation);
73
74 Q_INVOKABLE void setValues(qreal firstValue, qreal secondValue);
75
76 // 2.2 (Qt 5.9)
77 bool live() const;
78 void setLive(bool live);
79
80 // 2.3 (Qt 5.10)
81 bool isHorizontal() const;
82 bool isVertical() const;
83
84 // 2.5 (Qt 5.12)
85 qreal touchDragThreshold() const;
86 void setTouchDragThreshold(qreal touchDragThreshold);
87 void resetTouchDragThreshold();
89
91 void fromChanged();
92 void toChanged();
93 void stepSizeChanged();
94 void snapModeChanged();
95 void orientationChanged();
96 // 2.2 (Qt 5.9)
97 Q_REVISION(2, 2) void liveChanged();
98 // 2.5 (Qt 5.12)
99 Q_REVISION(2, 5) void touchDragThresholdChanged();
100
101protected:
102 void focusInEvent(QFocusEvent *event) override;
103 void hoverEnterEvent(QHoverEvent *event) override;
104 void hoverMoveEvent(QHoverEvent *event) override;
105 void hoverLeaveEvent(QHoverEvent *event) override;
106 void keyPressEvent(QKeyEvent *event) override;
107 void keyReleaseEvent(QKeyEvent *event) override;
108 void mousePressEvent(QMouseEvent *event) override;
109#if QT_CONFIG(quicktemplates2_multitouch)
110 void touchEvent(QTouchEvent *event) override;
111#endif
112 void mirrorChange() override;
113 void classBegin() override;
114 void componentComplete() override;
115
116#if QT_CONFIG(accessibility)
117 QAccessible::Role accessibleRole() const override;
118#endif
119
120private:
122
123 Q_DISABLE_COPY(QQuickRangeSlider)
124 Q_DECLARE_PRIVATE(QQuickRangeSlider)
125};
126
128
129class Q_QUICKTEMPLATES2_EXPORT QQuickRangeSliderNode : public QObject
130{
132 Q_PROPERTY(qreal value READ value WRITE setValue NOTIFY valueChanged FINAL)
133 Q_PROPERTY(qreal position READ position NOTIFY positionChanged FINAL)
134 Q_PROPERTY(qreal visualPosition READ visualPosition NOTIFY visualPositionChanged FINAL)
135 Q_PROPERTY(QQuickItem *handle READ handle WRITE setHandle NOTIFY handleChanged FINAL)
136 Q_PROPERTY(bool pressed READ isPressed WRITE setPressed NOTIFY pressedChanged FINAL)
137 // 2.1 (Qt 5.8)
138 Q_PROPERTY(bool hovered READ isHovered WRITE setHovered NOTIFY hoveredChanged FINAL REVISION(2, 1))
139 // 2.5 (Qt 5.12)
140 Q_PROPERTY(qreal implicitHandleWidth READ implicitHandleWidth NOTIFY implicitHandleWidthChanged FINAL REVISION(2, 5))
141 Q_PROPERTY(qreal implicitHandleHeight READ implicitHandleHeight NOTIFY implicitHandleHeightChanged FINAL REVISION(2, 5))
142 Q_CLASSINFO("DeferredPropertyNames", "handle")
145
146public:
149
150 qreal value() const;
151 void setValue(qreal value);
152
153 qreal position() const;
154 qreal visualPosition() const;
155
156 QQuickItem *handle() const;
157 void setHandle(QQuickItem *handle);
158
159 bool isPressed() const;
160 void setPressed(bool pressed);
161
162 // 2.1 (Qt 5.8)
163 bool isHovered() const;
164 void setHovered(bool hovered);
165
166 // 2.5 (Qt 5.12)
167 qreal implicitHandleWidth() const;
168 qreal implicitHandleHeight() const;
169
170public Q_SLOTS:
171 void increase();
172 void decrease();
173
175 void valueChanged();
176 void positionChanged();
177 void visualPositionChanged();
178 void handleChanged();
179 void pressedChanged();
180 // 2.1 (Qt 5.8)
181 Q_REVISION(2, 1) void hoveredChanged();
182 // 2.5 (Qt 5.12)
183 /*Q_REVISION(2, 5)*/ void moved();
184 /*Q_REVISION(2, 5)*/ void implicitHandleWidthChanged();
185 /*Q_REVISION(2, 5)*/ void implicitHandleHeightChanged();
186
187private:
188 Q_DISABLE_COPY(QQuickRangeSliderNode)
189 Q_DECLARE_PRIVATE(QQuickRangeSliderNode)
190};
191
193
194#endif // QQUICKRANGESLIDER_P_H
The QFocusEvent class contains event parameters for widget focus events.
Definition qevent.h:470
\inmodule QtGui
Definition qevent.h:246
The QKeyEvent class describes a key event.
Definition qevent.h:424
\inmodule QtGui
Definition qevent.h:196
\inmodule QtCore
Definition qobject.h:103
The QQuickItem class provides the most basic of all visual items in \l {Qt Quick}.
Definition qquickitem.h:63
Used to select a range of values by sliding two handles along a track.
Q_REVISION(2, 5) Q_INVOKABLE qreal valueAt(qreal position) const
The QTouchEvent class contains parameters that describe a touch event.
Definition qevent.h:917
Combined button and popup list for selecting options.
Definition qcompare.h:63
Orientation
Definition qnamespace.h:98
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
GLuint64 GLenum void * handle
GLenum mode
GLint first
struct _cl_event * event
#define QML_ANONYMOUS
#define QML_NAMED_ELEMENT(NAME)
#define QML_ADDED_IN_VERSION(MAJOR, MINOR)
static qreal position(const QQuickItem *item, QQuickAnchors::Anchor anchorLine)
static qreal valueAt(const QQuickRangeSlider *slider, qreal position)
#define Q_ENUM(x)
#define Q_PROPERTY(...)
#define Q_OBJECT
#define Q_REVISION(...)
#define Q_CLASSINFO(name, value)
#define Q_INVOKABLE
#define Q_SLOTS
#define Q_SIGNALS
double qreal
Definition qtypes.h:187
#define explicit
settings setValue("DataPump/bgcolor", color)