-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathlinearscale.hpp
More file actions
60 lines (41 loc) · 1.48 KB
/
linearscale.hpp
File metadata and controls
60 lines (41 loc) · 1.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#ifndef LINEARSCALEITEM_HPP
#define LINEARSCALEITEM_HPP
#include <QtQuick/QQuickItem>
#include <QtCore/QPointer>
#include <QtCore/QTimer>
class ScaleMap;
class QDeclarativeComponent;
class LinearScale : public QQuickItem
{
Q_OBJECT
Q_DISABLE_COPY(LinearScale)
Q_PROPERTY(ScaleMap* scaleMap READ scaleMap WRITE setScaleMap NOTIFY scaleMapChanged)
Q_PROPERTY(Qt::Orientation orientation READ orientation WRITE setOrientation NOTIFY orientationChanged)
Q_PROPERTY(QDeclarativeComponent* delegate READ delegate WRITE setDelegate NOTIFY delegateChanged)
public:
explicit LinearScale(QQuickItem* parent = 0);
ScaleMap* scaleMap() const;
Qt::Orientation orientation() const;
QDeclarativeComponent* delegate() const;
public slots:
void setScaleMap(ScaleMap* scaleMap);
void setOrientation(Qt::Orientation orientation);
void setDelegate(QDeclarativeComponent* delegate);
signals:
void scaleMapChanged(ScaleMap* scaleMap);
void orientationChanged(Qt::Orientation orientation);
void delegateChanged(QDeclarativeComponent* delegate);
protected:
virtual void geometryChanged(const QRectF &newGeometry,
const QRectF &oldGeometry);
private slots:
void updateTicks();
private:
QPointer<ScaleMap> m_scaleMap;
Qt::Orientation m_orientation;
QPointer<QDeclarativeComponent> m_delegate;
QList<QQuickItem*> m_ticks;
QTimer m_timer;
};
QML_DECLARE_TYPE(LinearScale)
#endif // LINEARSCALEITEM_HPP