1 | /**************************************************************************** |
2 | ** |
3 | ** Copyright (C) 2016 The Qt Company Ltd. |
4 | ** Contact: https://www.qt.io/licensing/ |
5 | ** |
6 | ** This file is part of the Qt Quick Controls module of the Qt Toolkit. |
7 | ** |
8 | ** $QT_BEGIN_LICENSE:LGPL$ |
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 https://www.qt.io/terms-conditions. For further |
15 | ** information use the contact form at https://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.LGPL3 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-3.0.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 (at your option) the GNU General |
28 | ** Public license version 3 or any later version approved by the KDE Free |
29 | ** Qt Foundation. The licenses are as published by the Free Software |
30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 |
31 | ** included in the packaging of this file. Please review the following |
32 | ** information to ensure the GNU General Public License requirements will |
33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and |
34 | ** https://www.gnu.org/licenses/gpl-3.0.html. |
35 | ** |
36 | ** $QT_END_LICENSE$ |
37 | ** |
38 | ****************************************************************************/ |
39 | |
40 | #ifndef QQUICKRANGEMODEL_P_H |
41 | #define QQUICKRANGEMODEL_P_H |
42 | |
43 | #include <QtCore/qobject.h> |
44 | #include <QtQml/qqml.h> |
45 | |
46 | QT_BEGIN_NAMESPACE |
47 | |
48 | class QQuickRangeModel1Private; |
49 | |
50 | class QQuickRangeModel1 : public QObject, public QQmlParserStatus |
51 | { |
52 | Q_OBJECT |
53 | Q_PROPERTY(qreal value READ value WRITE setValue NOTIFY valueChanged USER true) |
54 | Q_PROPERTY(qreal minimumValue READ minimum WRITE setMinimum NOTIFY minimumChanged) |
55 | Q_PROPERTY(qreal maximumValue READ maximum WRITE setMaximum NOTIFY maximumChanged) |
56 | Q_PROPERTY(qreal stepSize READ stepSize WRITE setStepSize NOTIFY stepSizeChanged) |
57 | Q_PROPERTY(qreal position READ position WRITE setPosition NOTIFY positionChanged) |
58 | Q_PROPERTY(qreal positionAtMinimum READ positionAtMinimum WRITE setPositionAtMinimum NOTIFY positionAtMinimumChanged) |
59 | Q_PROPERTY(qreal positionAtMaximum READ positionAtMaximum WRITE setPositionAtMaximum NOTIFY positionAtMaximumChanged) |
60 | Q_PROPERTY(bool inverted READ inverted WRITE setInverted NOTIFY invertedChanged) |
61 | |
62 | Q_INTERFACES(QQmlParserStatus) |
63 | |
64 | public: |
65 | QQuickRangeModel1(QObject *parent = 0); |
66 | virtual ~QQuickRangeModel1(); |
67 | |
68 | void setRange(qreal min, qreal max); |
69 | void setPositionRange(qreal min, qreal max); |
70 | |
71 | void setStepSize(qreal stepSize); |
72 | qreal stepSize() const; |
73 | |
74 | void setMinimum(qreal min); |
75 | qreal minimum() const; |
76 | |
77 | void setMaximum(qreal max); |
78 | qreal maximum() const; |
79 | |
80 | void setPositionAtMinimum(qreal posAtMin); |
81 | qreal positionAtMinimum() const; |
82 | |
83 | void setPositionAtMaximum(qreal posAtMax); |
84 | qreal positionAtMaximum() const; |
85 | |
86 | void setInverted(bool inverted); |
87 | bool inverted() const; |
88 | |
89 | qreal value() const; |
90 | qreal position() const; |
91 | |
92 | Q_INVOKABLE qreal valueForPosition(qreal position) const; |
93 | Q_INVOKABLE qreal positionForValue(qreal value) const; |
94 | |
95 | void classBegin() override; |
96 | void componentComplete() override; |
97 | |
98 | public Q_SLOTS: |
99 | void toMinimum(); |
100 | void toMaximum(); |
101 | void setValue(qreal value); |
102 | void setPosition(qreal position); |
103 | void increaseSingleStep(); |
104 | void decreaseSingleStep(); |
105 | |
106 | Q_SIGNALS: |
107 | void valueChanged(qreal value); |
108 | void positionChanged(qreal position); |
109 | |
110 | void stepSizeChanged(qreal stepSize); |
111 | |
112 | void invertedChanged(bool inverted); |
113 | |
114 | void minimumChanged(qreal min); |
115 | void maximumChanged(qreal max); |
116 | void positionAtMinimumChanged(qreal min); |
117 | void positionAtMaximumChanged(qreal max); |
118 | |
119 | protected: |
120 | QQuickRangeModel1(QQuickRangeModel1Private &dd, QObject *parent); |
121 | QQuickRangeModel1Private* d_ptr; |
122 | |
123 | private: |
124 | Q_DISABLE_COPY(QQuickRangeModel1) |
125 | Q_DECLARE_PRIVATE(QQuickRangeModel1) |
126 | |
127 | }; |
128 | |
129 | QT_END_NAMESPACE |
130 | |
131 | QML_DECLARE_TYPE(QQuickRangeModel1) |
132 | |
133 | #endif // QQUICKRANGEMODEL_P_H |
134 | |