@@ -1,71 +1,72 | |||||
1 | /**************************************************************************** |
|
1 | /**************************************************************************** | |
2 | ** |
|
2 | ** | |
3 | ** Copyright (C) 2012 Digia Plc |
|
3 | ** Copyright (C) 2012 Digia Plc | |
4 | ** All rights reserved. |
|
4 | ** All rights reserved. | |
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
5 | ** For any questions to Digia, please use contact form at http://qt.digia.com | |
6 | ** |
|
6 | ** | |
7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
7 | ** This file is part of the Qt Commercial Charts Add-on. | |
8 | ** |
|
8 | ** | |
9 | ** $QT_BEGIN_LICENSE$ |
|
9 | ** $QT_BEGIN_LICENSE$ | |
10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in | |
11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
11 | ** accordance with the Qt Commercial License Agreement provided with the | |
12 | ** Software or, alternatively, in accordance with the terms contained in |
|
12 | ** Software or, alternatively, in accordance with the terms contained in | |
13 | ** a written agreement between you and Digia. |
|
13 | ** a written agreement between you and Digia. | |
14 | ** |
|
14 | ** | |
15 | ** If you have questions regarding the use of this file, please use |
|
15 | ** If you have questions regarding the use of this file, please use | |
16 | ** contact form at http://qt.digia.com |
|
16 | ** contact form at http://qt.digia.com | |
17 | ** $QT_END_LICENSE$ |
|
17 | ** $QT_END_LICENSE$ | |
18 | ** |
|
18 | ** | |
19 | ****************************************************************************/ |
|
19 | ****************************************************************************/ | |
20 |
|
20 | |||
21 | #ifndef DECLARATIVECATEGORYAXIS_H |
|
21 | #ifndef DECLARATIVECATEGORYAXIS_H | |
22 | #define DECLARATIVECATEGORYAXIS_H |
|
22 | #define DECLARATIVECATEGORYAXIS_H | |
23 |
|
23 | |||
24 | #include "qcategoryaxis.h" |
|
24 | #include "qcategoryaxis.h" | |
25 | #include <QDeclarativeParserStatus> |
|
25 | #include <QDeclarativeParserStatus> | |
26 | #include <QDeclarativeListProperty> |
|
26 | #include <QDeclarativeListProperty> | |
27 |
|
27 | |||
28 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
28 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
29 |
|
29 | |||
30 | class DeclarativeCategoryRange : public QObject |
|
30 | class DeclarativeCategoryRange : public QObject | |
31 | { |
|
31 | { | |
32 | Q_OBJECT |
|
32 | Q_OBJECT | |
33 | Q_PROPERTY(qreal endValue READ endValue WRITE setEndValue) |
|
33 | Q_PROPERTY(qreal endValue READ endValue WRITE setEndValue) | |
34 | Q_PROPERTY(QString label READ label WRITE setLabel) |
|
34 | Q_PROPERTY(QString label READ label WRITE setLabel) | |
35 |
|
35 | |||
36 | public: |
|
36 | public: | |
37 | explicit DeclarativeCategoryRange(QObject *parent = 0); |
|
37 | explicit DeclarativeCategoryRange(QObject *parent = 0); | |
38 | qreal endValue() { return m_endValue; } |
|
38 | qreal endValue() { return m_endValue; } | |
39 | void setEndValue(qreal endValue) { m_endValue = endValue; } |
|
39 | void setEndValue(qreal endValue) { m_endValue = endValue; } | |
40 | QString label() { return m_label; } |
|
40 | QString label() { return m_label; } | |
41 | void setLabel(QString label) { m_label = label; } |
|
41 | void setLabel(QString label) { m_label = label; } | |
42 |
|
42 | |||
43 | private: |
|
43 | private: | |
44 | qreal m_endValue; |
|
44 | qreal m_endValue; | |
45 | QString m_label; |
|
45 | QString m_label; | |
46 | }; |
|
46 | }; | |
47 |
|
47 | |||
48 | class DeclarativeCategoryAxis : public QCategoryAxis, public QDeclarativeParserStatus |
|
48 | class DeclarativeCategoryAxis : public QCategoryAxis, public QDeclarativeParserStatus | |
49 | { |
|
49 | { | |
50 | Q_OBJECT |
|
50 | Q_OBJECT | |
|
51 | Q_INTERFACES(QDeclarativeParserStatus) | |||
51 | Q_PROPERTY(QDeclarativeListProperty<QObject> axisChildren READ axisChildren) |
|
52 | Q_PROPERTY(QDeclarativeListProperty<QObject> axisChildren READ axisChildren) | |
52 | Q_CLASSINFO("DefaultProperty", "axisChildren") |
|
53 | Q_CLASSINFO("DefaultProperty", "axisChildren") | |
53 |
|
54 | |||
54 | public: |
|
55 | public: | |
55 | explicit DeclarativeCategoryAxis(QObject *parent = 0); |
|
56 | explicit DeclarativeCategoryAxis(QObject *parent = 0); | |
56 | QDeclarativeListProperty<QObject> axisChildren(); |
|
57 | QDeclarativeListProperty<QObject> axisChildren(); | |
57 |
|
58 | |||
58 | public: // from QDeclarativeParserStatus |
|
59 | public: // from QDeclarativeParserStatus | |
59 | void classBegin(); |
|
60 | void classBegin(); | |
60 | void componentComplete(); |
|
61 | void componentComplete(); | |
61 |
|
62 | |||
62 | public Q_SLOTS: |
|
63 | public Q_SLOTS: | |
63 | Q_INVOKABLE void append(const QString &label, qreal categoryEndValue); |
|
64 | Q_INVOKABLE void append(const QString &label, qreal categoryEndValue); | |
64 | Q_INVOKABLE void remove(const QString &label); |
|
65 | Q_INVOKABLE void remove(const QString &label); | |
65 | Q_INVOKABLE void replace(const QString& oldLabel, const QString& newLabel); |
|
66 | Q_INVOKABLE void replace(const QString& oldLabel, const QString& newLabel); | |
66 | static void appendAxisChildren(QDeclarativeListProperty<QObject> *list, QObject *element); |
|
67 | static void appendAxisChildren(QDeclarativeListProperty<QObject> *list, QObject *element); | |
67 | }; |
|
68 | }; | |
68 |
|
69 | |||
69 | QTCOMMERCIALCHART_END_NAMESPACE |
|
70 | QTCOMMERCIALCHART_END_NAMESPACE | |
70 |
|
71 | |||
71 | #endif // DECLARATIVECATEGORYAXIS_H |
|
72 | #endif // DECLARATIVECATEGORYAXIS_H |
General Comments 0
You need to be logged in to leave comments.
Login now