1
/****************************************************************************
3
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
4
** Contact: http://www.qt-project.org/legal
6
** This file is part of Qt Creator.
8
** Commercial License Usage
9
** Licensees holding valid commercial Qt licenses may use this file in
10
** accordance with the commercial license agreement provided with the
11
** Software or, alternatively, in accordance with the terms contained in
12
** a written agreement between you and Digia. For licensing terms and
13
** conditions see http://qt.digia.com/licensing. For further information
14
** use the contact form at http://qt.digia.com/contact-us.
16
** GNU Lesser General Public License Usage
17
** Alternatively, this file may be used under the terms of the GNU Lesser
18
** General Public License version 2.1 as published by the Free Software
19
** Foundation and appearing in the file LICENSE.LGPL included in the
20
** packaging of this file. Please review the following information to
21
** ensure the GNU Lesser General Public License version 2.1 requirements
22
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24
** In addition, as a special exception, Digia gives you certain additional
25
** rights. These rights are described in the Digia Qt LGPL Exception
26
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28
****************************************************************************/
34
#include <qgraphicsitem.h>
35
#include <qabstractslider.h>
36
#include <qdeclarative.h>
38
class QRangeModelPrivate;
40
class QRangeModel : public QObject
43
Q_PROPERTY(qreal value READ value WRITE setValue NOTIFY valueChanged USER true)
44
Q_PROPERTY(qreal minimumValue READ minimum WRITE setMinimum NOTIFY minimumChanged)
45
Q_PROPERTY(qreal maximumValue READ maximum WRITE setMaximum NOTIFY maximumChanged)
46
Q_PROPERTY(qreal stepSize READ stepSize WRITE setStepSize NOTIFY stepSizeChanged)
47
Q_PROPERTY(qreal position READ position WRITE setPosition NOTIFY positionChanged)
48
Q_PROPERTY(qreal positionAtMinimum READ positionAtMinimum WRITE setPositionAtMinimum NOTIFY positionAtMinimumChanged)
49
Q_PROPERTY(qreal positionAtMaximum READ positionAtMaximum WRITE setPositionAtMaximum NOTIFY positionAtMaximumChanged)
50
Q_PROPERTY(bool inverted READ inverted WRITE setInverted NOTIFY invertedChanged)
53
QRangeModel(QObject *parent = 0);
54
virtual ~QRangeModel();
56
void setRange(qreal min, qreal max);
57
void setPositionRange(qreal min, qreal max);
59
void setStepSize(qreal stepSize);
60
qreal stepSize() const;
62
void setMinimum(qreal min);
63
qreal minimum() const;
65
void setMaximum(qreal max);
66
qreal maximum() const;
68
void setPositionAtMinimum(qreal posAtMin);
69
qreal positionAtMinimum() const;
71
void setPositionAtMaximum(qreal posAtMax);
72
qreal positionAtMaximum() const;
74
void setInverted(bool inverted);
75
bool inverted() const;
78
qreal position() const;
80
Q_INVOKABLE qreal valueForPosition(qreal position) const;
81
Q_INVOKABLE qreal positionForValue(qreal value) const;
86
void setValue(qreal value);
87
void setPosition(qreal position);
90
void valueChanged(qreal value);
91
void positionChanged(qreal position);
93
void stepSizeChanged(qreal stepSize);
95
void invertedChanged(bool inverted);
97
void minimumChanged(qreal min);
98
void maximumChanged(qreal max);
99
void positionAtMinimumChanged(qreal min);
100
void positionAtMaximumChanged(qreal max);
103
QRangeModel(QRangeModelPrivate &dd, QObject *parent);
104
QRangeModelPrivate* d_ptr;
107
Q_DISABLE_COPY(QRangeModel)
108
Q_DECLARE_PRIVATE(QRangeModel)
112
QML_DECLARE_TYPE(QRangeModel)
114
#endif // QRANGEMODEL_H