@@ -1,107 +1,107 | |||
|
1 | 1 | /**************************************************************************** |
|
2 | 2 | ** |
|
3 | 3 | ** Copyright (C) 2012 Digia Plc |
|
4 | 4 | ** All rights reserved. |
|
5 | 5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
6 | 6 | ** |
|
7 | 7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
8 | 8 | ** |
|
9 | 9 | ** $QT_BEGIN_LICENSE$ |
|
10 | 10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
11 | 11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
12 | 12 | ** Software or, alternatively, in accordance with the terms contained in |
|
13 | 13 | ** a written agreement between you and Digia. |
|
14 | 14 | ** |
|
15 | 15 | ** If you have questions regarding the use of this file, please use |
|
16 | 16 | ** contact form at http://qt.digia.com |
|
17 | 17 | ** $QT_END_LICENSE$ |
|
18 | 18 | ** |
|
19 | 19 | ****************************************************************************/ |
|
20 | 20 | |
|
21 | 21 | #ifndef DECLARATIVEBARSERIES_H |
|
22 | 22 | #define DECLARATIVEBARSERIES_H |
|
23 | 23 | |
|
24 | 24 | #include "qchartglobal.h" |
|
25 | 25 | #include "declarativemodel.h" |
|
26 | 26 | #include <QDeclarativeItem> |
|
27 | 27 | #include <QDeclarativeParserStatus> |
|
28 | 28 | #include <QGroupedBarSeries> |
|
29 | 29 | |
|
30 | 30 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
31 | 31 | |
|
32 | 32 | class QChart; |
|
33 | 33 | |
|
34 | 34 | class DeclarativeBarSet : public QBarSet |
|
35 | 35 | { |
|
36 | 36 | Q_OBJECT |
|
37 | 37 | Q_PROPERTY(QVariantList values READ values WRITE setValues) |
|
38 | 38 | Q_PROPERTY(QString name READ name WRITE setName) |
|
39 | 39 | |
|
40 | 40 | public: |
|
41 | 41 | explicit DeclarativeBarSet(QObject *parent = 0); |
|
42 | 42 | QVariantList values(); |
|
43 | 43 | void setValues(QVariantList values); |
|
44 | 44 | |
|
45 | 45 | public: // From QBarSet |
|
46 | 46 | Q_INVOKABLE void append(qreal value) { QBarSet::append(value); } |
|
47 | 47 | Q_INVOKABLE void append(qreal x, qreal y) { QBarSet::append(QPointF(x, y)); } |
|
48 | 48 | }; |
|
49 | 49 | |
|
50 | 50 | class DeclarativeBarSeries : public QBarSeries, public QDeclarativeParserStatus |
|
51 | 51 | { |
|
52 | 52 | Q_OBJECT |
|
53 | 53 | Q_INTERFACES(QDeclarativeParserStatus) |
|
54 | 54 | Q_PROPERTY(DeclarativeTableModel *model READ declarativeModel WRITE setDeclarativeModel) |
|
55 | 55 | Q_PROPERTY(QStringList barCategories READ barCategories WRITE setBarCategories) |
|
56 | 56 | Q_PROPERTY(QDeclarativeListProperty<DeclarativeBarSet> initialBarSets READ initialBarSets) |
|
57 | 57 | Q_CLASSINFO("DefaultProperty", "initialBarSets") |
|
58 | 58 | |
|
59 | 59 | public: |
|
60 | 60 | explicit DeclarativeBarSeries(QDeclarativeItem *parent = 0); |
|
61 | 61 | QDeclarativeListProperty<DeclarativeBarSet> initialBarSets(); |
|
62 | 62 | |
|
63 | 63 | void setBarCategories(QStringList categories); |
|
64 | 64 | QStringList barCategories(); |
|
65 | 65 | |
|
66 | 66 | public: // from QDeclarativeParserStatus |
|
67 | 67 | void classBegin(); |
|
68 | 68 | void componentComplete(); |
|
69 | 69 | |
|
70 | 70 | public: |
|
71 | 71 | bool setDeclarativeModel(DeclarativeTableModel *model); |
|
72 | 72 | DeclarativeTableModel *declarativeModel(); |
|
73 | 73 | |
|
74 | 74 | public Q_SLOTS: |
|
75 |
static void appendInitialBarSets(QDeclarativeListProperty<DeclarativeBarSet> |
|
|
75 | static void appendInitialBarSets(QDeclarativeListProperty<DeclarativeBarSet> * /*list*/, DeclarativeBarSet * /*element*/) {} | |
|
76 | 76 | }; |
|
77 | 77 | |
|
78 | 78 | class DeclarativeGroupedBarSeries : public QGroupedBarSeries, public QDeclarativeParserStatus |
|
79 | 79 | { |
|
80 | 80 | Q_OBJECT |
|
81 | 81 | Q_INTERFACES(QDeclarativeParserStatus) |
|
82 | 82 | Q_PROPERTY(DeclarativeTableModel *model READ declarativeModel WRITE setDeclarativeModel) |
|
83 | 83 | Q_PROPERTY(QStringList barCategories READ barCategories WRITE setBarCategories) |
|
84 | 84 | Q_PROPERTY(QDeclarativeListProperty<DeclarativeBarSet> initialBarSets READ initialBarSets) |
|
85 | 85 | Q_CLASSINFO("DefaultProperty", "initialBarSets") |
|
86 | 86 | |
|
87 | 87 | public: |
|
88 | 88 | explicit DeclarativeGroupedBarSeries(QDeclarativeItem *parent = 0); |
|
89 | 89 | QDeclarativeListProperty<DeclarativeBarSet> initialBarSets(); |
|
90 | 90 | |
|
91 | 91 | public: // from QDeclarativeParserStatus |
|
92 | 92 | void classBegin(); |
|
93 | 93 | void componentComplete(); |
|
94 | 94 | |
|
95 | 95 | public: |
|
96 | 96 | void setBarCategories(QStringList categories); |
|
97 | 97 | QStringList barCategories(); |
|
98 | 98 | bool setDeclarativeModel(DeclarativeTableModel *model); |
|
99 | 99 | DeclarativeTableModel *declarativeModel(); |
|
100 | 100 | |
|
101 | 101 | public Q_SLOTS: |
|
102 |
static void appendInitialBarSets(QDeclarativeListProperty<DeclarativeBarSet> |
|
|
102 | static void appendInitialBarSets(QDeclarativeListProperty<DeclarativeBarSet> * /*list*/, DeclarativeBarSet * /*element*/) {} | |
|
103 | 103 | }; |
|
104 | 104 | |
|
105 | 105 | QTCOMMERCIALCHART_END_NAMESPACE |
|
106 | 106 | |
|
107 | 107 | #endif // DECLARATIVEBARSERIES_H |
@@ -1,64 +1,64 | |||
|
1 | 1 | /**************************************************************************** |
|
2 | 2 | ** |
|
3 | 3 | ** Copyright (C) 2012 Digia Plc |
|
4 | 4 | ** All rights reserved. |
|
5 | 5 | ** For any questions to Digia, please use contact form at http://qt.digia.com |
|
6 | 6 | ** |
|
7 | 7 | ** This file is part of the Qt Commercial Charts Add-on. |
|
8 | 8 | ** |
|
9 | 9 | ** $QT_BEGIN_LICENSE$ |
|
10 | 10 | ** Licensees holding valid Qt Commercial licenses may use this file in |
|
11 | 11 | ** accordance with the Qt Commercial License Agreement provided with the |
|
12 | 12 | ** Software or, alternatively, in accordance with the terms contained in |
|
13 | 13 | ** a written agreement between you and Digia. |
|
14 | 14 | ** |
|
15 | 15 | ** If you have questions regarding the use of this file, please use |
|
16 | 16 | ** contact form at http://qt.digia.com |
|
17 | 17 | ** $QT_END_LICENSE$ |
|
18 | 18 | ** |
|
19 | 19 | ****************************************************************************/ |
|
20 | 20 | |
|
21 | 21 | #ifndef DECLARATIVEPIESERIES_H |
|
22 | 22 | #define DECLARATIVEPIESERIES_H |
|
23 | 23 | |
|
24 | 24 | #include "qchartglobal.h" |
|
25 | 25 | #include <QPieSlice> |
|
26 | 26 | #include <QPieSeries> |
|
27 | 27 | #include <QDeclarativeParserStatus> |
|
28 | 28 | #include <QDeclarativeListProperty> |
|
29 | 29 | #include <QAbstractItemModel> |
|
30 | 30 | #include <QVariant> |
|
31 | 31 | #include "declarativemodel.h" |
|
32 | 32 | |
|
33 | 33 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
34 | 34 | |
|
35 | 35 | class QChart; |
|
36 | 36 | |
|
37 | 37 | class DeclarativePieSeries : public QPieSeries, public QDeclarativeParserStatus |
|
38 | 38 | { |
|
39 | 39 | Q_OBJECT |
|
40 | 40 | Q_INTERFACES(QDeclarativeParserStatus) |
|
41 | 41 | Q_PROPERTY(DeclarativeTableModel *model READ pieModel WRITE setPieModel) |
|
42 | 42 | Q_PROPERTY(QDeclarativeListProperty<QPieSlice> initialSlices READ initialSlices) |
|
43 | 43 | Q_CLASSINFO("DefaultProperty", "initialSlices") |
|
44 | 44 | |
|
45 | 45 | public: |
|
46 | 46 | explicit DeclarativePieSeries(QObject *parent = 0); |
|
47 | 47 | QDeclarativeListProperty<QPieSlice> initialSlices(); |
|
48 | 48 | DeclarativeTableModel *pieModel(); |
|
49 | 49 | void setPieModel(DeclarativeTableModel *model); |
|
50 | 50 | Q_INVOKABLE QPieSlice *at(int index); |
|
51 | 51 | Q_INVOKABLE QPieSlice* find(QString label); |
|
52 | 52 | Q_INVOKABLE QPieSlice* append(QString label, qreal value); |
|
53 | 53 | |
|
54 | 54 | public: |
|
55 | 55 | void classBegin(); |
|
56 | 56 | void componentComplete(); |
|
57 | 57 | |
|
58 | 58 | public Q_SLOTS: |
|
59 |
static void appendInitialSlices(QDeclarativeListProperty<QPieSlice> |
|
|
59 | static void appendInitialSlices(QDeclarativeListProperty<QPieSlice> * /*list*/, QPieSlice * /*element*/) {} | |
|
60 | 60 | }; |
|
61 | 61 | |
|
62 | 62 | QTCOMMERCIALCHART_END_NAMESPACE |
|
63 | 63 | |
|
64 | 64 | #endif // DECLARATIVEPIESERIES_H |
General Comments 0
You need to be logged in to leave comments.
Login now