@@ -1,107 +1,107 | |||||
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 DECLARATIVEBARSERIES_H |
|
21 | #ifndef DECLARATIVEBARSERIES_H | |
22 | #define DECLARATIVEBARSERIES_H |
|
22 | #define DECLARATIVEBARSERIES_H | |
23 |
|
23 | |||
24 | #include "qchartglobal.h" |
|
24 | #include "qchartglobal.h" | |
25 | #include "declarativemodel.h" |
|
25 | #include "declarativemodel.h" | |
26 | #include <QDeclarativeItem> |
|
26 | #include <QDeclarativeItem> | |
27 | #include <QDeclarativeParserStatus> |
|
27 | #include <QDeclarativeParserStatus> | |
28 | #include <QGroupedBarSeries> |
|
28 | #include <QGroupedBarSeries> | |
29 |
|
29 | |||
30 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
30 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
31 |
|
31 | |||
32 | class QChart; |
|
32 | class QChart; | |
33 |
|
33 | |||
34 | class DeclarativeBarSet : public QBarSet |
|
34 | class DeclarativeBarSet : public QBarSet | |
35 | { |
|
35 | { | |
36 | Q_OBJECT |
|
36 | Q_OBJECT | |
37 | Q_PROPERTY(QVariantList values READ values WRITE setValues) |
|
37 | Q_PROPERTY(QVariantList values READ values WRITE setValues) | |
38 | Q_PROPERTY(QString name READ name WRITE setName) |
|
38 | Q_PROPERTY(QString name READ name WRITE setName) | |
39 |
|
39 | |||
40 | public: |
|
40 | public: | |
41 | explicit DeclarativeBarSet(QObject *parent = 0); |
|
41 | explicit DeclarativeBarSet(QObject *parent = 0); | |
42 | QVariantList values(); |
|
42 | QVariantList values(); | |
43 | void setValues(QVariantList values); |
|
43 | void setValues(QVariantList values); | |
44 |
|
44 | |||
45 | public: // From QBarSet |
|
45 | public: // From QBarSet | |
46 | Q_INVOKABLE void append(qreal value) { QBarSet::append(value); } |
|
46 | Q_INVOKABLE void append(qreal value) { QBarSet::append(value); } | |
47 | Q_INVOKABLE void append(qreal x, qreal y) { QBarSet::append(QPointF(x, y)); } |
|
47 | Q_INVOKABLE void append(qreal x, qreal y) { QBarSet::append(QPointF(x, y)); } | |
48 | }; |
|
48 | }; | |
49 |
|
49 | |||
50 | class DeclarativeBarSeries : public QBarSeries, public QDeclarativeParserStatus |
|
50 | class DeclarativeBarSeries : public QBarSeries, public QDeclarativeParserStatus | |
51 | { |
|
51 | { | |
52 | Q_OBJECT |
|
52 | Q_OBJECT | |
53 | Q_INTERFACES(QDeclarativeParserStatus) |
|
53 | Q_INTERFACES(QDeclarativeParserStatus) | |
54 | Q_PROPERTY(DeclarativeTableModel *model READ declarativeModel WRITE setDeclarativeModel) |
|
54 | Q_PROPERTY(DeclarativeTableModel *model READ declarativeModel WRITE setDeclarativeModel) | |
55 | Q_PROPERTY(QStringList barCategories READ barCategories WRITE setBarCategories) |
|
55 | Q_PROPERTY(QStringList barCategories READ barCategories WRITE setBarCategories) | |
56 | Q_PROPERTY(QDeclarativeListProperty<DeclarativeBarSet> initialBarSets READ initialBarSets) |
|
56 | Q_PROPERTY(QDeclarativeListProperty<DeclarativeBarSet> initialBarSets READ initialBarSets) | |
57 | Q_CLASSINFO("DefaultProperty", "initialBarSets") |
|
57 | Q_CLASSINFO("DefaultProperty", "initialBarSets") | |
58 |
|
58 | |||
59 | public: |
|
59 | public: | |
60 | explicit DeclarativeBarSeries(QDeclarativeItem *parent = 0); |
|
60 | explicit DeclarativeBarSeries(QDeclarativeItem *parent = 0); | |
61 | QDeclarativeListProperty<DeclarativeBarSet> initialBarSets(); |
|
61 | QDeclarativeListProperty<DeclarativeBarSet> initialBarSets(); | |
62 |
|
62 | |||
63 | void setBarCategories(QStringList categories); |
|
63 | void setBarCategories(QStringList categories); | |
64 | QStringList barCategories(); |
|
64 | QStringList barCategories(); | |
65 |
|
65 | |||
66 | public: // from QDeclarativeParserStatus |
|
66 | public: // from QDeclarativeParserStatus | |
67 | void classBegin(); |
|
67 | void classBegin(); | |
68 | void componentComplete(); |
|
68 | void componentComplete(); | |
69 |
|
69 | |||
70 | public: |
|
70 | public: | |
71 | bool setDeclarativeModel(DeclarativeTableModel *model); |
|
71 | bool setDeclarativeModel(DeclarativeTableModel *model); | |
72 | DeclarativeTableModel *declarativeModel(); |
|
72 | DeclarativeTableModel *declarativeModel(); | |
73 |
|
73 | |||
74 | public Q_SLOTS: |
|
74 | public Q_SLOTS: | |
75 |
static void appendInitialBarSets(QDeclarativeListProperty<DeclarativeBarSet> |
|
75 | static void appendInitialBarSets(QDeclarativeListProperty<DeclarativeBarSet> * /*list*/, DeclarativeBarSet * /*element*/) {} | |
76 | }; |
|
76 | }; | |
77 |
|
77 | |||
78 | class DeclarativeGroupedBarSeries : public QGroupedBarSeries, public QDeclarativeParserStatus |
|
78 | class DeclarativeGroupedBarSeries : public QGroupedBarSeries, public QDeclarativeParserStatus | |
79 | { |
|
79 | { | |
80 | Q_OBJECT |
|
80 | Q_OBJECT | |
81 | Q_INTERFACES(QDeclarativeParserStatus) |
|
81 | Q_INTERFACES(QDeclarativeParserStatus) | |
82 | Q_PROPERTY(DeclarativeTableModel *model READ declarativeModel WRITE setDeclarativeModel) |
|
82 | Q_PROPERTY(DeclarativeTableModel *model READ declarativeModel WRITE setDeclarativeModel) | |
83 | Q_PROPERTY(QStringList barCategories READ barCategories WRITE setBarCategories) |
|
83 | Q_PROPERTY(QStringList barCategories READ barCategories WRITE setBarCategories) | |
84 | Q_PROPERTY(QDeclarativeListProperty<DeclarativeBarSet> initialBarSets READ initialBarSets) |
|
84 | Q_PROPERTY(QDeclarativeListProperty<DeclarativeBarSet> initialBarSets READ initialBarSets) | |
85 | Q_CLASSINFO("DefaultProperty", "initialBarSets") |
|
85 | Q_CLASSINFO("DefaultProperty", "initialBarSets") | |
86 |
|
86 | |||
87 | public: |
|
87 | public: | |
88 | explicit DeclarativeGroupedBarSeries(QDeclarativeItem *parent = 0); |
|
88 | explicit DeclarativeGroupedBarSeries(QDeclarativeItem *parent = 0); | |
89 | QDeclarativeListProperty<DeclarativeBarSet> initialBarSets(); |
|
89 | QDeclarativeListProperty<DeclarativeBarSet> initialBarSets(); | |
90 |
|
90 | |||
91 | public: // from QDeclarativeParserStatus |
|
91 | public: // from QDeclarativeParserStatus | |
92 | void classBegin(); |
|
92 | void classBegin(); | |
93 | void componentComplete(); |
|
93 | void componentComplete(); | |
94 |
|
94 | |||
95 | public: |
|
95 | public: | |
96 | void setBarCategories(QStringList categories); |
|
96 | void setBarCategories(QStringList categories); | |
97 | QStringList barCategories(); |
|
97 | QStringList barCategories(); | |
98 | bool setDeclarativeModel(DeclarativeTableModel *model); |
|
98 | bool setDeclarativeModel(DeclarativeTableModel *model); | |
99 | DeclarativeTableModel *declarativeModel(); |
|
99 | DeclarativeTableModel *declarativeModel(); | |
100 |
|
100 | |||
101 | public Q_SLOTS: |
|
101 | public Q_SLOTS: | |
102 |
static void appendInitialBarSets(QDeclarativeListProperty<DeclarativeBarSet> |
|
102 | static void appendInitialBarSets(QDeclarativeListProperty<DeclarativeBarSet> * /*list*/, DeclarativeBarSet * /*element*/) {} | |
103 | }; |
|
103 | }; | |
104 |
|
104 | |||
105 | QTCOMMERCIALCHART_END_NAMESPACE |
|
105 | QTCOMMERCIALCHART_END_NAMESPACE | |
106 |
|
106 | |||
107 | #endif // DECLARATIVEBARSERIES_H |
|
107 | #endif // DECLARATIVEBARSERIES_H |
@@ -1,64 +1,64 | |||||
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 DECLARATIVEPIESERIES_H |
|
21 | #ifndef DECLARATIVEPIESERIES_H | |
22 | #define DECLARATIVEPIESERIES_H |
|
22 | #define DECLARATIVEPIESERIES_H | |
23 |
|
23 | |||
24 | #include "qchartglobal.h" |
|
24 | #include "qchartglobal.h" | |
25 | #include <QPieSlice> |
|
25 | #include <QPieSlice> | |
26 | #include <QPieSeries> |
|
26 | #include <QPieSeries> | |
27 | #include <QDeclarativeParserStatus> |
|
27 | #include <QDeclarativeParserStatus> | |
28 | #include <QDeclarativeListProperty> |
|
28 | #include <QDeclarativeListProperty> | |
29 | #include <QAbstractItemModel> |
|
29 | #include <QAbstractItemModel> | |
30 | #include <QVariant> |
|
30 | #include <QVariant> | |
31 | #include "declarativemodel.h" |
|
31 | #include "declarativemodel.h" | |
32 |
|
32 | |||
33 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
33 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
34 |
|
34 | |||
35 | class QChart; |
|
35 | class QChart; | |
36 |
|
36 | |||
37 | class DeclarativePieSeries : public QPieSeries, public QDeclarativeParserStatus |
|
37 | class DeclarativePieSeries : public QPieSeries, public QDeclarativeParserStatus | |
38 | { |
|
38 | { | |
39 | Q_OBJECT |
|
39 | Q_OBJECT | |
40 | Q_INTERFACES(QDeclarativeParserStatus) |
|
40 | Q_INTERFACES(QDeclarativeParserStatus) | |
41 | Q_PROPERTY(DeclarativeTableModel *model READ pieModel WRITE setPieModel) |
|
41 | Q_PROPERTY(DeclarativeTableModel *model READ pieModel WRITE setPieModel) | |
42 | Q_PROPERTY(QDeclarativeListProperty<QPieSlice> initialSlices READ initialSlices) |
|
42 | Q_PROPERTY(QDeclarativeListProperty<QPieSlice> initialSlices READ initialSlices) | |
43 | Q_CLASSINFO("DefaultProperty", "initialSlices") |
|
43 | Q_CLASSINFO("DefaultProperty", "initialSlices") | |
44 |
|
44 | |||
45 | public: |
|
45 | public: | |
46 | explicit DeclarativePieSeries(QObject *parent = 0); |
|
46 | explicit DeclarativePieSeries(QObject *parent = 0); | |
47 | QDeclarativeListProperty<QPieSlice> initialSlices(); |
|
47 | QDeclarativeListProperty<QPieSlice> initialSlices(); | |
48 | DeclarativeTableModel *pieModel(); |
|
48 | DeclarativeTableModel *pieModel(); | |
49 | void setPieModel(DeclarativeTableModel *model); |
|
49 | void setPieModel(DeclarativeTableModel *model); | |
50 | Q_INVOKABLE QPieSlice *at(int index); |
|
50 | Q_INVOKABLE QPieSlice *at(int index); | |
51 | Q_INVOKABLE QPieSlice* find(QString label); |
|
51 | Q_INVOKABLE QPieSlice* find(QString label); | |
52 | Q_INVOKABLE QPieSlice* append(QString label, qreal value); |
|
52 | Q_INVOKABLE QPieSlice* append(QString label, qreal value); | |
53 |
|
53 | |||
54 | public: |
|
54 | public: | |
55 | void classBegin(); |
|
55 | void classBegin(); | |
56 | void componentComplete(); |
|
56 | void componentComplete(); | |
57 |
|
57 | |||
58 | public Q_SLOTS: |
|
58 | public Q_SLOTS: | |
59 |
static void appendInitialSlices(QDeclarativeListProperty<QPieSlice> |
|
59 | static void appendInitialSlices(QDeclarativeListProperty<QPieSlice> * /*list*/, QPieSlice * /*element*/) {} | |
60 | }; |
|
60 | }; | |
61 |
|
61 | |||
62 | QTCOMMERCIALCHART_END_NAMESPACE |
|
62 | QTCOMMERCIALCHART_END_NAMESPACE | |
63 |
|
63 | |||
64 | #endif // DECLARATIVEPIESERIES_H |
|
64 | #endif // DECLARATIVEPIESERIES_H |
General Comments 0
You need to be logged in to leave comments.
Login now