@@ -1,48 +1,49 | |||
|
1 | 1 | !include(config.pri) { |
|
2 | 2 | error('Missing config.pri') |
|
3 | 3 | } |
|
4 | 4 | |
|
5 | 5 | TEMPLATE = subdirs |
|
6 |
SUBDIRS = src plugins |
|
|
6 | SUBDIRS = src plugins | |
|
7 | #examples demos tests | |
|
7 | 8 | |
|
8 | 9 | development_build: message('Development build') |
|
9 | 10 | |
|
10 | 11 | CONFIG += ordered |
|
11 | 12 | QMAKE_CXXFLAGS += -g -Wall |
|
12 | 13 | unix:QMAKE_DISTCLEAN += -r build bin include lib doc/html |
|
13 | 14 | win32:QMAKE_DISTCLEAN += /Q /s build bin include lib doc\\html |
|
14 | 15 | |
|
15 | 16 | # install feature file |
|
16 | 17 | feature.path = $$[QT_INSTALL_DATA]/mkspecs/features |
|
17 | 18 | feature.files = $$PWD/features/qtcommercialchart.prf |
|
18 | 19 | INSTALLS += feature |
|
19 | 20 | |
|
20 | 21 | docs.target = docs |
|
21 | 22 | win32:{ |
|
22 | 23 | docs.commands = qdoc3 $$CHART_BUILD_DOC_DIR\\qcharts.qdocconf |
|
23 | 24 | }else{ |
|
24 | 25 | docs.commands = qdoc3 $$CHART_BUILD_DOC_DIR/qcharts.qdocconf |
|
25 | 26 | } |
|
26 | 27 | docs.depends = FORCE |
|
27 | 28 | QMAKE_EXTRA_TARGETS += docs |
|
28 | 29 | |
|
29 | 30 | unix:coverage:{ |
|
30 | 31 | QMAKE_DISTCLEAN += -r ./coverage |
|
31 | 32 | QMAKE_CLEAN += build/*.gcda build/*.gcno |
|
32 | 33 | QMAKE_EXTRA_TARGETS += buildcoverage runcoverage gencoverage |
|
33 | 34 | |
|
34 | 35 | buildcoverage.target = build_coverage |
|
35 | 36 | buildcoverage.depends = all |
|
36 | 37 | buildcoverage.commands = mkdir -p ./coverage; \ |
|
37 | 38 | make -C src prepare_coverage; |
|
38 | 39 | |
|
39 | 40 | runcoverage.target = run_coverage |
|
40 | 41 | runcoverage.depends = buildcoverage |
|
41 | 42 | runcoverage.commands = for f in `ls ./bin/tst_*` ; do echo "processing \$\$f test..."; \$\$f >> unit.log; done ; exit 0; |
|
42 | 43 | |
|
43 | 44 | gencoverage.target = gen_coverage |
|
44 | 45 | gencoverage.depends = runcoverage |
|
45 | 46 | gencoverage.commands = make -C src gen_coverage; \ |
|
46 | 47 | genhtml -o ./coverage ./coverage/coverage.info --prefix $$PWD |
|
47 | 48 | } |
|
48 | 49 |
@@ -1,118 +1,120 | |||
|
1 | 1 | ##################### LIB ################################################# |
|
2 | 2 | |
|
3 | 3 | LIBRARY_NAME = QtCommercialChart |
|
4 | 4 | CONFIG(debug, debug|release) { |
|
5 | 5 | mac: LIBRARY_NAME = $$join(LIBRARY_NAME,,,_debug) |
|
6 | 6 | win32: LIBRARY_NAME = $$join(LIBRARY_NAME,,,d) |
|
7 | 7 | } |
|
8 | 8 | |
|
9 | 9 | LIBS += -l$$LIBRARY_NAME |
|
10 | 10 | |
|
11 | 11 | # This will undefine Q_DECL_EXPORT/Q_DECL_IMPORT at qchartglobal.h |
|
12 | 12 | # They should not be used for staticlib builds. |
|
13 | 13 | staticlib:DEFINES+=QTCOMMERCIALCHART_STATICLIB |
|
14 | 14 | |
|
15 | 15 | #################### COVERAGE ################################################################# |
|
16 | 16 | coverage: CONFIG += debug |
|
17 | 17 | |
|
18 | 18 | ##################### SHADOW CONFIG ################################################# |
|
19 | 19 | |
|
20 | 20 | !contains($${PWD}, $${OUT_PWD}){ |
|
21 | 21 | search = "$$PWD:::" |
|
22 | 22 | temp = $$split(search,"/") |
|
23 | 23 | temp = $$last(temp) |
|
24 | 24 | path = $$replace(search,$$temp,'') |
|
25 | 25 | temp = $$split(OUT_PWD,$$path) |
|
26 | 26 | temp = $$split(temp,'/') |
|
27 | 27 | temp = $$first(temp) |
|
28 | 28 | path = "$${path}$${temp}" |
|
29 | 29 | SHADOW=$$path |
|
30 | 30 | }else{ |
|
31 | 31 | SHADOW=$$PWD |
|
32 | 32 | CONFIG-=development_build |
|
33 | 33 | } |
|
34 | 34 | |
|
35 | 35 | ##################### BUILD PATHS ################################################## |
|
36 | 36 | |
|
37 | 37 | CHART_BUILD_PUBLIC_HEADER_DIR = $$SHADOW/include |
|
38 | 38 | CHART_BUILD_PRIVATE_HEADER_DIR = $$CHART_BUILD_PUBLIC_HEADER_DIR/private |
|
39 | 39 | CHART_BUILD_LIB_DIR = $$SHADOW/lib |
|
40 | 40 | CHART_BUILD_DIR = $$SHADOW/build |
|
41 | 41 | CHART_BUILD_BIN_DIR = $$SHADOW/bin |
|
42 | 42 | CHART_BUILD_QML_PLUGIN_DIR = $$CHART_BUILD_BIN_DIR |
|
43 | 43 | CHART_BUILD_DESIGNER_PLUGIN_DIR = $$CHART_BUILD_LIB_DIR |
|
44 | 44 | CHART_BUILD_DOC_DIR = $$SHADOW/doc |
|
45 | 45 | |
|
46 | 46 | CONFIG(release,debug|release){ |
|
47 | 47 | CHART_BUILD_LIB_DIR = $$CHART_BUILD_LIB_DIR/release |
|
48 | 48 | CHART_BUILD_BIN_DIR = $$CHART_BUILD_BIN_DIR/release |
|
49 | 49 | CHART_BUILD_QML_PLUGIN_DIR = $$CHART_BUILD_QML_PLUGIN_DIR/release/QtCommercial/Chart |
|
50 | 50 | CHART_BUILD_DESIGNER_PLUGIN_DIR = $$CHART_BUILD_LIB_DIR |
|
51 | 51 | } |
|
52 | 52 | |
|
53 | 53 | |
|
54 | 54 | CONFIG(debug,debug|release){ |
|
55 | 55 | CHART_BUILD_LIB_DIR = $$CHART_BUILD_LIB_DIR/debug |
|
56 | 56 | CHART_BUILD_BIN_DIR = $$CHART_BUILD_BIN_DIR/debug |
|
57 | 57 | CHART_BUILD_QML_PLUGIN_DIR = $$CHART_BUILD_QML_PLUGIN_DIR/debug/QtCommercial/Chart |
|
58 | 58 | CHART_BUILD_DESIGNER_PLUGIN_DIR = $$CHART_BUILD_LIB_DIR |
|
59 | 59 | } |
|
60 | 60 | # Use own folders for debug and release builds |
|
61 | 61 | |
|
62 | 62 | CONFIG(debug, debug|release):CHART_BUILD_DIR = $$join(CHART_BUILD_DIR,,,/debug) |
|
63 | 63 | CONFIG(release, debug|release): CHART_BUILD_DIR = $$join(CHART_BUILD_DIR,,,/release) |
|
64 | 64 | |
|
65 | 65 | |
|
66 | 66 | win32:{ |
|
67 | 67 | CHART_BUILD_PUBLIC_HEADER_DIR = $$replace(CHART_BUILD_PUBLIC_HEADER_DIR, "/","\\") |
|
68 | 68 | CHART_BUILD_PRIVATE_HEADER_DIR = $$replace(CHART_BUILD_PRIVATE_HEADER_DIR, "/","\\") |
|
69 | 69 | CHART_BUILD_BUILD_DIR = $$replace(CHART_BUILD_BUILD_DIR, "/","\\") |
|
70 | 70 | CHART_BUILD_BIN_DIR = $$replace(CHART_BUILD_BIN_DIR, "/","\\") |
|
71 | 71 | CHART_BUILD_QML_PLUGIN_DIR = $$replace(CHART_BUILD_QML_PLUGIN_DIR, "/","\\") |
|
72 | 72 | CHART_BUILD_DESIGNER_PLUGIN_DIR = $$replace(CHART_BUILD_DESIGNER_PLUGIN_DIR, "/","\\") |
|
73 | 73 | CHART_BUILD_DOC_DIR = $$replace(CHART_BUILD_DOC_DIR, "/","\\") |
|
74 | 74 | CHART_BUILD_LIB_DIR = $$replace(CHART_BUILD_LIB_DIR, "/","\\") |
|
75 | 75 | } |
|
76 | 76 | |
|
77 | 77 | mac: { |
|
78 | 78 | # Some Qt versions use an incompatible configuration on OSX which makes the build fail. |
|
79 | 79 | # As a work-around, set the minimum OSX version to 10.5. |
|
80 | 80 | QMAKE_CXXFLAGS *= -mmacosx-version-min=10.5 |
|
81 | 81 | QMAKE_LFLAGS *= -mmacosx-version-min=10.5 |
|
82 | 82 | } |
|
83 | 83 | |
|
84 | 84 | linux-arm*: { |
|
85 | 85 | DEFINES+=QT_ON_ARM |
|
86 | 86 | } |
|
87 | 87 | |
|
88 | greaterThan(QT_MAJOR_VERSION, 4): DEFINES += QT5_QUICK_1 | |
|
89 | ||
|
88 | 90 | ##################### INCLUDES ############################################################ |
|
89 | 91 | |
|
90 | 92 | |
|
91 | 93 | INCLUDEPATH += $$CHART_BUILD_PUBLIC_HEADER_DIR |
|
92 | 94 | |
|
93 | 95 | !win32: { |
|
94 | 96 | LIBS += -L$$CHART_BUILD_LIB_DIR -Wl,-rpath,$$CHART_BUILD_LIB_DIR |
|
95 | 97 | } else { |
|
96 | 98 | win32-msvc*: { |
|
97 | 99 | # hack fix for error: |
|
98 | 100 | # "LINK : fatal error LNK1146: no argument specified with option '/LIBPATH:'" |
|
99 | 101 | QMAKE_LIBDIR += $$CHART_BUILD_LIB_DIR |
|
100 | 102 | } else { |
|
101 | 103 | LIBS += -L$$CHART_BUILD_LIB_DIR |
|
102 | 104 | } |
|
103 | 105 | } |
|
104 | 106 | |
|
105 | 107 | ##################### DEVELOPMENT BUILD ################################################### |
|
106 | 108 | |
|
107 | 109 | development_build: { |
|
108 | 110 | DEFINES+=DEVELOPMENT_BUILD |
|
109 | 111 | CONFIG+=debug_and_release |
|
110 | 112 | CONFIG+=build_all |
|
111 | 113 | } |
|
112 | 114 | |
|
113 | 115 | ##################### UNIT TESTS ############################################################## |
|
114 | 116 | |
|
115 | 117 | CONFIG(debug, debug|release) { |
|
116 | 118 | DEFINES+=BUILD_PRIVATE_UNIT_TESTS |
|
117 | 119 | } |
|
118 | 120 |
@@ -1,308 +1,313 | |||
|
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 "qbarseries.h" |
|
25 | 25 | #include "qstackedbarseries.h" |
|
26 | 26 | #include "qpercentbarseries.h" |
|
27 | 27 | #include "qhorizontalbarseries.h" |
|
28 | 28 | #include "qhorizontalstackedbarseries.h" |
|
29 | 29 | #include "qhorizontalpercentbarseries.h" |
|
30 | 30 | #include "qbarset.h" |
|
31 | #include <QDeclarativeItem> | |
|
32 |
#include <QDeclarative |
|
|
31 | #ifdef QT5_QUICK_1 | |
|
32 | #include <QtQuick1/QDeclarativeItem> | |
|
33 | #include <QtQuick1/QDeclarativeParserStatus> | |
|
34 | #else | |
|
35 | #include <QtDeclarative/QDeclarativeItem> | |
|
36 | #include <QtDeclarative/QDeclarativeParserStatus> | |
|
37 | #endif | |
|
33 | 38 | |
|
34 | 39 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
35 | 40 | |
|
36 | 41 | class QChart; |
|
37 | 42 | |
|
38 | 43 | class DeclarativeBarSet : public QBarSet |
|
39 | 44 | { |
|
40 | 45 | Q_OBJECT |
|
41 | 46 | Q_PROPERTY(QVariantList values READ values WRITE setValues) |
|
42 | 47 | Q_PROPERTY(qreal borderWidth READ borderWidth WRITE setBorderWidth NOTIFY borderWidthChanged REVISION 1) |
|
43 | 48 | Q_PROPERTY(int count READ count NOTIFY countChanged) |
|
44 | 49 | |
|
45 | 50 | public: |
|
46 | 51 | explicit DeclarativeBarSet(QObject *parent = 0); |
|
47 | 52 | QVariantList values(); |
|
48 | 53 | void setValues(QVariantList values); |
|
49 | 54 | qreal borderWidth() const; |
|
50 | 55 | void setBorderWidth(qreal borderWidth); |
|
51 | 56 | |
|
52 | 57 | public: // From QBarSet |
|
53 | 58 | Q_INVOKABLE void append(qreal value) { QBarSet::append(value); } |
|
54 | 59 | Q_INVOKABLE void remove(const int index, const int count = 1) { QBarSet::remove(index, count); } |
|
55 | 60 | Q_INVOKABLE void replace(int index, qreal value) { QBarSet::replace(index, value); } |
|
56 | 61 | Q_INVOKABLE qreal at(int index) { return QBarSet::at(index); } |
|
57 | 62 | |
|
58 | 63 | Q_SIGNALS: |
|
59 | 64 | void countChanged(int count); |
|
60 | 65 | Q_REVISION(1) void borderWidthChanged(qreal width); |
|
61 | 66 | |
|
62 | 67 | private Q_SLOTS: |
|
63 | 68 | void handleCountChanged(int index, int count); |
|
64 | 69 | }; |
|
65 | 70 | |
|
66 | 71 | class DeclarativeBarSeries : public QBarSeries, public QDeclarativeParserStatus |
|
67 | 72 | { |
|
68 | 73 | Q_OBJECT |
|
69 | 74 | Q_INTERFACES(QDeclarativeParserStatus) |
|
70 | 75 | Q_PROPERTY(QAbstractAxis *axisX READ axisX WRITE setAxisX NOTIFY axisXChanged REVISION 1) |
|
71 | 76 | Q_PROPERTY(QAbstractAxis *axisY READ axisY WRITE setAxisY NOTIFY axisYChanged REVISION 1) |
|
72 | 77 | Q_PROPERTY(QDeclarativeListProperty<QObject> seriesChildren READ seriesChildren) |
|
73 | 78 | Q_CLASSINFO("DefaultProperty", "seriesChildren") |
|
74 | 79 | |
|
75 | 80 | public: |
|
76 | 81 | explicit DeclarativeBarSeries(QDeclarativeItem *parent = 0); |
|
77 | 82 | QAbstractAxis *axisX() { return m_axisX; } |
|
78 | 83 | void setAxisX(QAbstractAxis *axis) { m_axisX = axis; emit axisXChanged(axis); } |
|
79 | 84 | QAbstractAxis *axisY() { return m_axisY; } |
|
80 | 85 | void setAxisY(QAbstractAxis *axis) { m_axisY = axis; emit axisYChanged(axis); } |
|
81 | 86 | QDeclarativeListProperty<QObject> seriesChildren(); |
|
82 | 87 | |
|
83 | 88 | public: |
|
84 | 89 | Q_INVOKABLE DeclarativeBarSet *at(int index); |
|
85 | 90 | Q_INVOKABLE DeclarativeBarSet *append(QString label, QVariantList values) { return insert(count(), label, values); } |
|
86 | 91 | Q_INVOKABLE DeclarativeBarSet *insert(int index, QString label, QVariantList values); |
|
87 | 92 | Q_INVOKABLE bool remove(QBarSet *barset) { return QBarSeries::remove(barset); } |
|
88 | 93 | Q_INVOKABLE void clear() { return QBarSeries::clear(); } |
|
89 | 94 | |
|
90 | 95 | public: // from QDeclarativeParserStatus |
|
91 | 96 | void classBegin(); |
|
92 | 97 | void componentComplete(); |
|
93 | 98 | |
|
94 | 99 | Q_SIGNALS: |
|
95 | 100 | Q_REVISION(1) void axisXChanged(QAbstractAxis *axis); |
|
96 | 101 | Q_REVISION(1) void axisYChanged(QAbstractAxis *axis); |
|
97 | 102 | |
|
98 | 103 | public Q_SLOTS: |
|
99 | 104 | static void appendSeriesChildren(QDeclarativeListProperty<QObject> *list, QObject *element); |
|
100 | 105 | |
|
101 | 106 | private: |
|
102 | 107 | QAbstractAxis* m_axisX; |
|
103 | 108 | QAbstractAxis* m_axisY; |
|
104 | 109 | }; |
|
105 | 110 | |
|
106 | 111 | class DeclarativeStackedBarSeries : public QStackedBarSeries, public QDeclarativeParserStatus |
|
107 | 112 | { |
|
108 | 113 | Q_OBJECT |
|
109 | 114 | Q_INTERFACES(QDeclarativeParserStatus) |
|
110 | 115 | Q_PROPERTY(QAbstractAxis *axisX READ axisX WRITE setAxisX NOTIFY axisXChanged REVISION 1) |
|
111 | 116 | Q_PROPERTY(QAbstractAxis *axisY READ axisY WRITE setAxisY NOTIFY axisYChanged REVISION 1) |
|
112 | 117 | Q_PROPERTY(QDeclarativeListProperty<QObject> seriesChildren READ seriesChildren) |
|
113 | 118 | Q_CLASSINFO("DefaultProperty", "seriesChildren") |
|
114 | 119 | |
|
115 | 120 | public: |
|
116 | 121 | explicit DeclarativeStackedBarSeries(QDeclarativeItem *parent = 0); |
|
117 | 122 | QAbstractAxis *axisX() { return m_axisX; } |
|
118 | 123 | void setAxisX(QAbstractAxis *axis) { m_axisX = axis; emit axisXChanged(axis); } |
|
119 | 124 | QAbstractAxis *axisY() { return m_axisY; } |
|
120 | 125 | void setAxisY(QAbstractAxis *axis) { m_axisY = axis; emit axisYChanged(axis); } |
|
121 | 126 | QDeclarativeListProperty<QObject> seriesChildren(); |
|
122 | 127 | |
|
123 | 128 | public: |
|
124 | 129 | Q_INVOKABLE DeclarativeBarSet *at(int index); |
|
125 | 130 | Q_INVOKABLE DeclarativeBarSet *append(QString label, QVariantList values) { return insert(count(), label, values); } |
|
126 | 131 | Q_INVOKABLE DeclarativeBarSet *insert(int index, QString label, QVariantList values); |
|
127 | 132 | Q_INVOKABLE bool remove(QBarSet *barset) { return QStackedBarSeries::remove(barset); } |
|
128 | 133 | Q_INVOKABLE void clear() { return QStackedBarSeries::clear(); } |
|
129 | 134 | |
|
130 | 135 | public: // from QDeclarativeParserStatus |
|
131 | 136 | void classBegin(); |
|
132 | 137 | void componentComplete(); |
|
133 | 138 | |
|
134 | 139 | Q_SIGNALS: |
|
135 | 140 | Q_REVISION(1) void axisXChanged(QAbstractAxis *axis); |
|
136 | 141 | Q_REVISION(1) void axisYChanged(QAbstractAxis *axis); |
|
137 | 142 | |
|
138 | 143 | public Q_SLOTS: |
|
139 | 144 | static void appendSeriesChildren(QDeclarativeListProperty<QObject> *list, QObject *element); |
|
140 | 145 | |
|
141 | 146 | private: |
|
142 | 147 | QAbstractAxis* m_axisX; |
|
143 | 148 | QAbstractAxis* m_axisY; |
|
144 | 149 | }; |
|
145 | 150 | |
|
146 | 151 | class DeclarativePercentBarSeries : public QPercentBarSeries, public QDeclarativeParserStatus |
|
147 | 152 | { |
|
148 | 153 | Q_OBJECT |
|
149 | 154 | Q_INTERFACES(QDeclarativeParserStatus) |
|
150 | 155 | Q_PROPERTY(QAbstractAxis *axisX READ axisX WRITE setAxisX NOTIFY axisXChanged REVISION 1) |
|
151 | 156 | Q_PROPERTY(QAbstractAxis *axisY READ axisY WRITE setAxisY NOTIFY axisYChanged REVISION 1) |
|
152 | 157 | Q_PROPERTY(QDeclarativeListProperty<QObject> seriesChildren READ seriesChildren) |
|
153 | 158 | Q_CLASSINFO("DefaultProperty", "seriesChildren") |
|
154 | 159 | |
|
155 | 160 | public: |
|
156 | 161 | explicit DeclarativePercentBarSeries(QDeclarativeItem *parent = 0); |
|
157 | 162 | QAbstractAxis *axisX() { return m_axisX; } |
|
158 | 163 | void setAxisX(QAbstractAxis *axis) { m_axisX = axis; emit axisXChanged(axis); } |
|
159 | 164 | QAbstractAxis *axisY() { return m_axisY; } |
|
160 | 165 | void setAxisY(QAbstractAxis *axis) { m_axisY = axis; emit axisYChanged(axis); } |
|
161 | 166 | QDeclarativeListProperty<QObject> seriesChildren(); |
|
162 | 167 | |
|
163 | 168 | public: |
|
164 | 169 | Q_INVOKABLE DeclarativeBarSet *at(int index); |
|
165 | 170 | Q_INVOKABLE DeclarativeBarSet *append(QString label, QVariantList values) { return insert(count(), label, values); } |
|
166 | 171 | Q_INVOKABLE DeclarativeBarSet *insert(int index, QString label, QVariantList values); |
|
167 | 172 | Q_INVOKABLE bool remove(QBarSet *barset) { return QPercentBarSeries::remove(barset); } |
|
168 | 173 | Q_INVOKABLE void clear() { return QPercentBarSeries::clear(); } |
|
169 | 174 | |
|
170 | 175 | public: // from QDeclarativeParserStatus |
|
171 | 176 | void classBegin(); |
|
172 | 177 | void componentComplete(); |
|
173 | 178 | |
|
174 | 179 | Q_SIGNALS: |
|
175 | 180 | Q_REVISION(1) void axisXChanged(QAbstractAxis *axis); |
|
176 | 181 | Q_REVISION(1) void axisYChanged(QAbstractAxis *axis); |
|
177 | 182 | |
|
178 | 183 | public Q_SLOTS: |
|
179 | 184 | static void appendSeriesChildren(QDeclarativeListProperty<QObject> *list, QObject *element); |
|
180 | 185 | |
|
181 | 186 | private: |
|
182 | 187 | QAbstractAxis* m_axisX; |
|
183 | 188 | QAbstractAxis* m_axisY; |
|
184 | 189 | }; |
|
185 | 190 | |
|
186 | 191 | class DeclarativeHorizontalBarSeries : public QHorizontalBarSeries, public QDeclarativeParserStatus |
|
187 | 192 | { |
|
188 | 193 | Q_OBJECT |
|
189 | 194 | Q_INTERFACES(QDeclarativeParserStatus) |
|
190 | 195 | Q_PROPERTY(QAbstractAxis *axisX READ axisX WRITE setAxisX NOTIFY axisXChanged REVISION 1) |
|
191 | 196 | Q_PROPERTY(QAbstractAxis *axisY READ axisY WRITE setAxisY NOTIFY axisYChanged REVISION 1) |
|
192 | 197 | Q_PROPERTY(QDeclarativeListProperty<QObject> seriesChildren READ seriesChildren) |
|
193 | 198 | Q_CLASSINFO("DefaultProperty", "seriesChildren") |
|
194 | 199 | |
|
195 | 200 | public: |
|
196 | 201 | explicit DeclarativeHorizontalBarSeries(QDeclarativeItem *parent = 0); |
|
197 | 202 | QAbstractAxis *axisX() { return m_axisX; } |
|
198 | 203 | void setAxisX(QAbstractAxis *axis) { m_axisX = axis; emit axisXChanged(axis); } |
|
199 | 204 | QAbstractAxis *axisY() { return m_axisY; } |
|
200 | 205 | void setAxisY(QAbstractAxis *axis) { m_axisY = axis; emit axisYChanged(axis); } |
|
201 | 206 | QDeclarativeListProperty<QObject> seriesChildren(); |
|
202 | 207 | |
|
203 | 208 | public: |
|
204 | 209 | Q_INVOKABLE DeclarativeBarSet *at(int index); |
|
205 | 210 | Q_INVOKABLE DeclarativeBarSet *append(QString label, QVariantList values) { return insert(count(), label, values); } |
|
206 | 211 | Q_INVOKABLE DeclarativeBarSet *insert(int index, QString label, QVariantList values); |
|
207 | 212 | Q_INVOKABLE bool remove(QBarSet *barset) { return QHorizontalBarSeries::remove(barset); } |
|
208 | 213 | Q_INVOKABLE void clear() { return QHorizontalBarSeries::clear(); } |
|
209 | 214 | |
|
210 | 215 | public: // from QDeclarativeParserStatus |
|
211 | 216 | void classBegin(); |
|
212 | 217 | void componentComplete(); |
|
213 | 218 | |
|
214 | 219 | Q_SIGNALS: |
|
215 | 220 | Q_REVISION(1) void axisXChanged(QAbstractAxis *axis); |
|
216 | 221 | Q_REVISION(1) void axisYChanged(QAbstractAxis *axis); |
|
217 | 222 | |
|
218 | 223 | public Q_SLOTS: |
|
219 | 224 | static void appendSeriesChildren(QDeclarativeListProperty<QObject> *list, QObject *element); |
|
220 | 225 | |
|
221 | 226 | private: |
|
222 | 227 | QAbstractAxis* m_axisX; |
|
223 | 228 | QAbstractAxis* m_axisY; |
|
224 | 229 | }; |
|
225 | 230 | |
|
226 | 231 | class DeclarativeHorizontalStackedBarSeries : public QHorizontalStackedBarSeries, public QDeclarativeParserStatus |
|
227 | 232 | { |
|
228 | 233 | Q_OBJECT |
|
229 | 234 | Q_INTERFACES(QDeclarativeParserStatus) |
|
230 | 235 | Q_PROPERTY(QAbstractAxis *axisX READ axisX WRITE setAxisX NOTIFY axisXChanged REVISION 1) |
|
231 | 236 | Q_PROPERTY(QAbstractAxis *axisY READ axisY WRITE setAxisY NOTIFY axisYChanged REVISION 1) |
|
232 | 237 | Q_PROPERTY(QDeclarativeListProperty<QObject> seriesChildren READ seriesChildren) |
|
233 | 238 | Q_CLASSINFO("DefaultProperty", "seriesChildren") |
|
234 | 239 | |
|
235 | 240 | public: |
|
236 | 241 | explicit DeclarativeHorizontalStackedBarSeries(QDeclarativeItem *parent = 0); |
|
237 | 242 | QAbstractAxis *axisX() { return m_axisX; } |
|
238 | 243 | void setAxisX(QAbstractAxis *axis) { m_axisX = axis; emit axisXChanged(axis); } |
|
239 | 244 | QAbstractAxis *axisY() { return m_axisY; } |
|
240 | 245 | void setAxisY(QAbstractAxis *axis) { m_axisY = axis; emit axisYChanged(axis); } |
|
241 | 246 | QDeclarativeListProperty<QObject> seriesChildren(); |
|
242 | 247 | |
|
243 | 248 | public: |
|
244 | 249 | Q_INVOKABLE DeclarativeBarSet *at(int index); |
|
245 | 250 | Q_INVOKABLE DeclarativeBarSet *append(QString label, QVariantList values) { return insert(count(), label, values); } |
|
246 | 251 | Q_INVOKABLE DeclarativeBarSet *insert(int index, QString label, QVariantList values); |
|
247 | 252 | Q_INVOKABLE bool remove(QBarSet *barset) { return QHorizontalStackedBarSeries::remove(barset); } |
|
248 | 253 | Q_INVOKABLE void clear() { return QHorizontalStackedBarSeries::clear(); } |
|
249 | 254 | |
|
250 | 255 | public: // from QDeclarativeParserStatus |
|
251 | 256 | void classBegin(); |
|
252 | 257 | void componentComplete(); |
|
253 | 258 | |
|
254 | 259 | Q_SIGNALS: |
|
255 | 260 | Q_REVISION(1) void axisXChanged(QAbstractAxis *axis); |
|
256 | 261 | Q_REVISION(1) void axisYChanged(QAbstractAxis *axis); |
|
257 | 262 | |
|
258 | 263 | public Q_SLOTS: |
|
259 | 264 | static void appendSeriesChildren(QDeclarativeListProperty<QObject> *list, QObject *element); |
|
260 | 265 | |
|
261 | 266 | private: |
|
262 | 267 | QAbstractAxis* m_axisX; |
|
263 | 268 | QAbstractAxis* m_axisY; |
|
264 | 269 | }; |
|
265 | 270 | |
|
266 | 271 | class DeclarativeHorizontalPercentBarSeries : public QHorizontalPercentBarSeries, public QDeclarativeParserStatus |
|
267 | 272 | { |
|
268 | 273 | Q_OBJECT |
|
269 | 274 | Q_INTERFACES(QDeclarativeParserStatus) |
|
270 | 275 | Q_PROPERTY(QAbstractAxis *axisX READ axisX WRITE setAxisX NOTIFY axisXChanged REVISION 1) |
|
271 | 276 | Q_PROPERTY(QAbstractAxis *axisY READ axisY WRITE setAxisY NOTIFY axisYChanged REVISION 1) |
|
272 | 277 | Q_PROPERTY(QDeclarativeListProperty<QObject> seriesChildren READ seriesChildren) |
|
273 | 278 | Q_CLASSINFO("DefaultProperty", "seriesChildren") |
|
274 | 279 | |
|
275 | 280 | public: |
|
276 | 281 | explicit DeclarativeHorizontalPercentBarSeries(QDeclarativeItem *parent = 0); |
|
277 | 282 | QAbstractAxis *axisX() { return m_axisX; } |
|
278 | 283 | void setAxisX(QAbstractAxis *axis) { m_axisX = axis; emit axisXChanged(axis); } |
|
279 | 284 | QAbstractAxis *axisY() { return m_axisY; } |
|
280 | 285 | void setAxisY(QAbstractAxis *axis) { m_axisY = axis; emit axisYChanged(axis); } |
|
281 | 286 | QDeclarativeListProperty<QObject> seriesChildren(); |
|
282 | 287 | |
|
283 | 288 | public: |
|
284 | 289 | Q_INVOKABLE DeclarativeBarSet *at(int index); |
|
285 | 290 | Q_INVOKABLE DeclarativeBarSet *append(QString label, QVariantList values) { return insert(count(), label, values); } |
|
286 | 291 | Q_INVOKABLE DeclarativeBarSet *insert(int index, QString label, QVariantList values); |
|
287 | 292 | Q_INVOKABLE bool remove(QBarSet *barset) { return QHorizontalPercentBarSeries::remove(barset); } |
|
288 | 293 | Q_INVOKABLE void clear() { return QHorizontalPercentBarSeries::clear(); } |
|
289 | 294 | |
|
290 | 295 | public: // from QDeclarativeParserStatus |
|
291 | 296 | void classBegin(); |
|
292 | 297 | void componentComplete(); |
|
293 | 298 | |
|
294 | 299 | Q_SIGNALS: |
|
295 | 300 | Q_REVISION(1) void axisXChanged(QAbstractAxis *axis); |
|
296 | 301 | Q_REVISION(1) void axisYChanged(QAbstractAxis *axis); |
|
297 | 302 | |
|
298 | 303 | public Q_SLOTS: |
|
299 | 304 | static void appendSeriesChildren(QDeclarativeListProperty<QObject> *list, QObject *element); |
|
300 | 305 | |
|
301 | 306 | private: |
|
302 | 307 | QAbstractAxis* m_axisX; |
|
303 | 308 | QAbstractAxis* m_axisY; |
|
304 | 309 | }; |
|
305 | 310 | |
|
306 | 311 | QTCOMMERCIALCHART_END_NAMESPACE |
|
307 | 312 | |
|
308 | 313 | #endif // DECLARATIVEBARSERIES_H |
@@ -1,72 +1,77 | |||
|
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 DECLARATIVECATEGORYAXIS_H |
|
22 | 22 | #define DECLARATIVECATEGORYAXIS_H |
|
23 | 23 | |
|
24 | 24 | #include "qcategoryaxis.h" |
|
25 | #include <QDeclarativeParserStatus> | |
|
26 | #include <QDeclarativeListProperty> | |
|
25 | #ifdef QT5_QUICK_1 | |
|
26 | #include <QtQuick1/QDeclarativeListProperty> | |
|
27 | #include <QtQuick1/QDeclarativeParserStatus> | |
|
28 | #else | |
|
29 | #include <QtDeclarative/QDeclarativeListProperty> | |
|
30 | #include <QtDeclarative/QDeclarativeParserStatus> | |
|
31 | #endif | |
|
27 | 32 | |
|
28 | 33 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
29 | 34 | |
|
30 | 35 | class DeclarativeCategoryRange : public QObject |
|
31 | 36 | { |
|
32 | 37 | Q_OBJECT |
|
33 | 38 | Q_PROPERTY(qreal endValue READ endValue WRITE setEndValue) |
|
34 | 39 | Q_PROPERTY(QString label READ label WRITE setLabel) |
|
35 | 40 | |
|
36 | 41 | public: |
|
37 | 42 | explicit DeclarativeCategoryRange(QObject *parent = 0); |
|
38 | 43 | qreal endValue() { return m_endValue; } |
|
39 | 44 | void setEndValue(qreal endValue) { m_endValue = endValue; } |
|
40 | 45 | QString label() { return m_label; } |
|
41 | 46 | void setLabel(QString label) { m_label = label; } |
|
42 | 47 | |
|
43 | 48 | private: |
|
44 | 49 | qreal m_endValue; |
|
45 | 50 | QString m_label; |
|
46 | 51 | }; |
|
47 | 52 | |
|
48 | 53 | class DeclarativeCategoryAxis : public QCategoryAxis, public QDeclarativeParserStatus |
|
49 | 54 | { |
|
50 | 55 | Q_OBJECT |
|
51 | 56 | Q_INTERFACES(QDeclarativeParserStatus) |
|
52 | 57 | Q_PROPERTY(QDeclarativeListProperty<QObject> axisChildren READ axisChildren) |
|
53 | 58 | Q_CLASSINFO("DefaultProperty", "axisChildren") |
|
54 | 59 | |
|
55 | 60 | public: |
|
56 | 61 | explicit DeclarativeCategoryAxis(QObject *parent = 0); |
|
57 | 62 | QDeclarativeListProperty<QObject> axisChildren(); |
|
58 | 63 | |
|
59 | 64 | public: // from QDeclarativeParserStatus |
|
60 | 65 | void classBegin(); |
|
61 | 66 | void componentComplete(); |
|
62 | 67 | |
|
63 | 68 | public Q_SLOTS: |
|
64 | 69 | Q_INVOKABLE void append(const QString &label, qreal categoryEndValue); |
|
65 | 70 | Q_INVOKABLE void remove(const QString &label); |
|
66 | 71 | Q_INVOKABLE void replace(const QString& oldLabel, const QString& newLabel); |
|
67 | 72 | static void appendAxisChildren(QDeclarativeListProperty<QObject> *list, QObject *element); |
|
68 | 73 | }; |
|
69 | 74 | |
|
70 | 75 | QTCOMMERCIALCHART_END_NAMESPACE |
|
71 | 76 | |
|
72 | 77 | #endif // DECLARATIVECATEGORYAXIS_H |
@@ -1,162 +1,166 | |||
|
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 DECLARATIVECHART_H |
|
22 | 22 | #define DECLARATIVECHART_H |
|
23 | 23 | |
|
24 | 24 | #include <QtCore/QtGlobal> |
|
25 | #include <QDeclarativeItem> | |
|
25 | #ifdef QT5_QUICK_1 | |
|
26 | #include <QtQuick1/QDeclarativeItem> | |
|
27 | #else | |
|
28 | #include <QtDeclarative/QDeclarativeItem> | |
|
29 | #endif | |
|
26 | 30 | #include "qchart.h" |
|
27 | 31 | |
|
28 | 32 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
29 | 33 | |
|
30 | 34 | class DeclarativeMargins; |
|
31 | 35 | |
|
32 | 36 | class DeclarativeChart : public QDeclarativeItem |
|
33 | 37 | { |
|
34 | 38 | Q_OBJECT |
|
35 | 39 | Q_PROPERTY(Theme theme READ theme WRITE setTheme) |
|
36 | 40 | Q_PROPERTY(Animation animationOptions READ animationOptions WRITE setAnimationOptions) |
|
37 | 41 | Q_PROPERTY(QString title READ title WRITE setTitle) |
|
38 | 42 | Q_PROPERTY(QFont titleFont READ titleFont WRITE setTitleFont) |
|
39 | 43 | Q_PROPERTY(QColor titleColor READ titleColor WRITE setTitleColor NOTIFY titleColorChanged) |
|
40 | 44 | Q_PROPERTY(QLegend *legend READ legend) |
|
41 | 45 | Q_PROPERTY(int count READ count) |
|
42 | 46 | Q_PROPERTY(QColor backgroundColor READ backgroundColor WRITE setBackgroundColor NOTIFY backgroundColorChanged) |
|
43 | 47 | Q_PROPERTY(bool dropShadowEnabled READ dropShadowEnabled WRITE setDropShadowEnabled NOTIFY dropShadowEnabledChanged) |
|
44 | 48 | Q_PROPERTY(qreal topMargin READ topMargin) |
|
45 | 49 | Q_PROPERTY(qreal bottomMargin READ bottomMargin) |
|
46 | 50 | Q_PROPERTY(qreal leftMargin READ leftMargin) |
|
47 | 51 | Q_PROPERTY(qreal rightMargin READ rightMargin) |
|
48 | 52 | Q_PROPERTY(DeclarativeMargins *minimumMargins READ minimumMargins NOTIFY minimumMarginsChanged REVISION 1) |
|
49 | 53 | Q_PROPERTY(QRectF plotArea READ plotArea NOTIFY plotAreaChanged REVISION 1) |
|
50 | 54 | Q_ENUMS(Animation) |
|
51 | 55 | Q_ENUMS(Theme) |
|
52 | 56 | Q_ENUMS(SeriesType) |
|
53 | 57 | |
|
54 | 58 | public: |
|
55 | 59 | // duplicating enums from QChart to make the QML api namings 1-to-1 with the C++ api |
|
56 | 60 | enum Theme { |
|
57 | 61 | ChartThemeLight = 0, |
|
58 | 62 | ChartThemeBlueCerulean, |
|
59 | 63 | ChartThemeDark, |
|
60 | 64 | ChartThemeBrownSand, |
|
61 | 65 | ChartThemeBlueNcs, |
|
62 | 66 | ChartThemeHighContrast, |
|
63 | 67 | ChartThemeBlueIcy |
|
64 | 68 | }; |
|
65 | 69 | |
|
66 | 70 | enum Animation { |
|
67 | 71 | NoAnimation = 0x0, |
|
68 | 72 | GridAxisAnimations = 0x1, |
|
69 | 73 | SeriesAnimations =0x2, |
|
70 | 74 | AllAnimations = 0x3 |
|
71 | 75 | }; |
|
72 | 76 | |
|
73 | 77 | enum SeriesType { |
|
74 | 78 | SeriesTypeLine, |
|
75 | 79 | SeriesTypeArea, |
|
76 | 80 | SeriesTypeBar, |
|
77 | 81 | SeriesTypeStackedBar, |
|
78 | 82 | SeriesTypePercentBar, |
|
79 | 83 | SeriesTypePie, |
|
80 | 84 | SeriesTypeScatter, |
|
81 | 85 | SeriesTypeSpline, |
|
82 | 86 | SeriesTypeHorizontalBar, |
|
83 | 87 | SeriesTypeHorizontalStackedBar, |
|
84 | 88 | SeriesTypeHorizontalPercentBar |
|
85 | 89 | }; |
|
86 | 90 | |
|
87 | 91 | public: |
|
88 | 92 | DeclarativeChart(QDeclarativeItem *parent = 0); |
|
89 | 93 | ~DeclarativeChart(); |
|
90 | 94 | |
|
91 | 95 | public: // From QDeclarativeItem/QGraphicsItem |
|
92 | 96 | void childEvent(QChildEvent *event); |
|
93 | 97 | void componentComplete(); |
|
94 | 98 | void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry); |
|
95 | 99 | |
|
96 | 100 | public: |
|
97 | 101 | void setTheme(DeclarativeChart::Theme theme); |
|
98 | 102 | DeclarativeChart::Theme theme(); |
|
99 | 103 | void setAnimationOptions(DeclarativeChart::Animation animations); |
|
100 | 104 | DeclarativeChart::Animation animationOptions(); |
|
101 | 105 | void setTitle(QString title); |
|
102 | 106 | QString title(); |
|
103 | 107 | QLegend *legend(); |
|
104 | 108 | QFont titleFont() const; |
|
105 | 109 | void setTitleFont(const QFont& font); |
|
106 | 110 | void setTitleColor(QColor color); |
|
107 | 111 | QColor titleColor(); |
|
108 | 112 | void setBackgroundColor(QColor color); |
|
109 | 113 | QColor backgroundColor(); |
|
110 | 114 | int count(); |
|
111 | 115 | void setDropShadowEnabled(bool enabled); |
|
112 | 116 | bool dropShadowEnabled(); |
|
113 | 117 | qreal topMargin(); |
|
114 | 118 | qreal bottomMargin(); |
|
115 | 119 | qreal leftMargin(); |
|
116 | 120 | qreal rightMargin(); |
|
117 | 121 | void createDefaultAxes(QAbstractSeries* series); |
|
118 | 122 | DeclarativeMargins *minimumMargins() { return m_minMargins; } |
|
119 | 123 | QRectF plotArea() { return m_chart->plotArea(); } |
|
120 | 124 | |
|
121 | 125 | public: |
|
122 | 126 | Q_INVOKABLE QAbstractSeries *series(int index); |
|
123 | 127 | Q_INVOKABLE QAbstractSeries *series(QString seriesName); |
|
124 | 128 | Q_INVOKABLE QAbstractSeries *createSeries(DeclarativeChart::SeriesType type, QString name = ""); |
|
125 | 129 | Q_INVOKABLE QAbstractSeries *createSeries(DeclarativeChart::SeriesType type, QString name, QAbstractAxis *axisX, QAbstractAxis *axisY); |
|
126 | 130 | Q_INVOKABLE void removeSeries(QAbstractSeries *series) { m_chart->removeSeries(series); } |
|
127 | 131 | Q_INVOKABLE void removeAllSeries() { m_chart->removeAllSeries(); } |
|
128 | 132 | Q_INVOKABLE void setAxisX(QAbstractAxis *axis, QAbstractSeries *series = 0); |
|
129 | 133 | Q_INVOKABLE void setAxisY(QAbstractAxis *axis, QAbstractSeries *series = 0); |
|
130 | 134 | Q_INVOKABLE void createDefaultAxes(); |
|
131 | 135 | Q_INVOKABLE QAbstractAxis *axisX(QAbstractSeries *series = 0); |
|
132 | 136 | Q_INVOKABLE QAbstractAxis *axisY(QAbstractSeries *series = 0); |
|
133 | 137 | Q_INVOKABLE void zoom(qreal factor); |
|
134 | 138 | Q_INVOKABLE void scrollLeft(qreal pixels); |
|
135 | 139 | Q_INVOKABLE void scrollRight(qreal pixels); |
|
136 | 140 | Q_INVOKABLE void scrollUp(qreal pixels); |
|
137 | 141 | Q_INVOKABLE void scrollDown(qreal pixels); |
|
138 | 142 | |
|
139 | 143 | Q_SIGNALS: |
|
140 | 144 | void axisLabelsChanged(); |
|
141 | 145 | void titleColorChanged(QColor color); |
|
142 | 146 | void backgroundColorChanged(); |
|
143 | 147 | void dropShadowEnabledChanged(bool enabled); |
|
144 | 148 | void minimumMarginsChanged(); |
|
145 | 149 | void plotAreaChanged(QRectF plotArea); |
|
146 | 150 | |
|
147 | 151 | public Q_SLOTS: |
|
148 | 152 | void changeMinimumMargins(int top, int bottom, int left, int right); |
|
149 | 153 | void handleAxisXSet(QAbstractAxis *axis); |
|
150 | 154 | void handleAxisYSet(QAbstractAxis *axis); |
|
151 | 155 | |
|
152 | 156 | private: |
|
153 | 157 | // Extending QChart with DeclarativeChart is not possible because QObject does not support |
|
154 | 158 | // multi inheritance, so we now have a QChart as a member instead |
|
155 | 159 | QChart *m_chart; |
|
156 | 160 | //QMargins m_chartMargins; |
|
157 | 161 | DeclarativeMargins *m_minMargins; |
|
158 | 162 | }; |
|
159 | 163 | |
|
160 | 164 | QTCOMMERCIALCHART_END_NAMESPACE |
|
161 | 165 | |
|
162 | 166 | #endif // DECLARATIVECHART_H |
@@ -1,90 +1,95 | |||
|
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 DECLARATIVELINESERIES_H |
|
22 | 22 | #define DECLARATIVELINESERIES_H |
|
23 | 23 | |
|
24 | 24 | #include "qlineseries.h" |
|
25 | 25 | #include "declarativexyseries.h" |
|
26 | #include <QDeclarativeListProperty> | |
|
27 |
#include <QDeclarative |
|
|
26 | #ifdef QT5_QUICK_1 | |
|
27 | #include <QtQuick1/QDeclarativeListProperty> | |
|
28 | #include <QtQuick1/QDeclarativeParserStatus> | |
|
29 | #else | |
|
30 | #include <QtDeclarative/QDeclarativeListProperty> | |
|
31 | #include <QtDeclarative/QDeclarativeParserStatus> | |
|
32 | #endif | |
|
28 | 33 | |
|
29 | 34 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
30 | 35 | |
|
31 | 36 | class DeclarativeLineSeries : public QLineSeries, public DeclarativeXySeries, public QDeclarativeParserStatus |
|
32 | 37 | { |
|
33 | 38 | Q_OBJECT |
|
34 | 39 | Q_INTERFACES(QDeclarativeParserStatus) |
|
35 | 40 | Q_PROPERTY(int count READ count NOTIFY countChanged) |
|
36 | 41 | Q_PROPERTY(QAbstractAxis *axisX READ axisX WRITE setAxisX NOTIFY axisXChanged REVISION 1) |
|
37 | 42 | Q_PROPERTY(QAbstractAxis *axisY READ axisY WRITE setAxisY NOTIFY axisYChanged REVISION 1) |
|
38 | 43 | Q_PROPERTY(qreal width READ width WRITE setWidth NOTIFY widthChanged REVISION 1) |
|
39 | 44 | Q_PROPERTY(Qt::PenStyle style READ style WRITE setStyle NOTIFY styleChanged REVISION 1) |
|
40 | 45 | Q_PROPERTY(Qt::PenCapStyle capStyle READ capStyle WRITE setCapStyle NOTIFY capStyleChanged REVISION 1) |
|
41 | 46 | Q_PROPERTY(QDeclarativeListProperty<QObject> declarativeChildren READ declarativeChildren) |
|
42 | 47 | Q_CLASSINFO("DefaultProperty", "declarativeChildren") |
|
43 | 48 | |
|
44 | 49 | public: |
|
45 | 50 | explicit DeclarativeLineSeries(QObject *parent = 0); |
|
46 | 51 | QXYSeries *xySeries() { return this; } |
|
47 | 52 | QAbstractAxis *axisX() { return m_axisX; } |
|
48 | 53 | void setAxisX(QAbstractAxis *axis) { m_axisX = axis; emit axisXChanged(axis); } |
|
49 | 54 | QAbstractAxis *axisY() { return m_axisY; } |
|
50 | 55 | void setAxisY(QAbstractAxis *axis) { m_axisY = axis; emit axisYChanged(axis); } |
|
51 | 56 | qreal width() const; |
|
52 | 57 | void setWidth(qreal width); |
|
53 | 58 | Qt::PenStyle style() const; |
|
54 | 59 | void setStyle(Qt::PenStyle style); |
|
55 | 60 | Qt::PenCapStyle capStyle() const; |
|
56 | 61 | void setCapStyle(Qt::PenCapStyle capStyle); |
|
57 | 62 | QDeclarativeListProperty<QObject> declarativeChildren(); |
|
58 | 63 | |
|
59 | 64 | public: // from QDeclarativeParserStatus |
|
60 | 65 | void classBegin() { DeclarativeXySeries::classBegin(); } |
|
61 | 66 | void componentComplete() { DeclarativeXySeries::componentComplete(); } |
|
62 | 67 | |
|
63 | 68 | public: |
|
64 | 69 | Q_INVOKABLE void append(qreal x, qreal y) { DeclarativeXySeries::append(x, y); } |
|
65 | 70 | Q_INVOKABLE void replace(qreal oldX, qreal oldY, qreal newX, qreal newY) { DeclarativeXySeries::replace(oldX, oldY, newX, newY); } |
|
66 | 71 | Q_INVOKABLE void remove(qreal x, qreal y) { DeclarativeXySeries::remove(x, y); } |
|
67 | 72 | Q_INVOKABLE void insert(int index, qreal x, qreal y) { DeclarativeXySeries::insert(index, x, y); } |
|
68 | 73 | Q_INVOKABLE void clear() { DeclarativeXySeries::clear(); } |
|
69 | 74 | Q_INVOKABLE QPointF at(int index) { return DeclarativeXySeries::at(index); } |
|
70 | 75 | |
|
71 | 76 | Q_SIGNALS: |
|
72 | 77 | void countChanged(int count); |
|
73 | 78 | Q_REVISION(1) void axisXChanged(QAbstractAxis *axis); |
|
74 | 79 | Q_REVISION(1) void axisYChanged(QAbstractAxis *axis); |
|
75 | 80 | Q_REVISION(1) void widthChanged(qreal width); |
|
76 | 81 | Q_REVISION(1) void styleChanged(Qt::PenStyle style); |
|
77 | 82 | Q_REVISION(1) void capStyleChanged(Qt::PenCapStyle capStyle); |
|
78 | 83 | |
|
79 | 84 | public Q_SLOTS: |
|
80 | 85 | static void appendDeclarativeChildren(QDeclarativeListProperty<QObject> *list, QObject *element); |
|
81 | 86 | void handleCountChanged(int index); |
|
82 | 87 | |
|
83 | 88 | private: |
|
84 | 89 | QAbstractAxis *m_axisX; |
|
85 | 90 | QAbstractAxis *m_axisY; |
|
86 | 91 | }; |
|
87 | 92 | |
|
88 | 93 | QTCOMMERCIALCHART_END_NAMESPACE |
|
89 | 94 | |
|
90 | 95 | #endif // DECLARATIVELINESERIES_H |
@@ -1,63 +1,68 | |||
|
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 "qpieseries.h" |
|
25 | #include <QDeclarativeItem> | |
|
26 |
#include <QDeclarative |
|
|
25 | #ifdef QT5_QUICK_1 | |
|
26 | #include <QtQuick1/QDeclarativeItem> | |
|
27 | #include <QtQuick1/QDeclarativeParserStatus> | |
|
28 | #else | |
|
29 | #include <QtDeclarative/QDeclarativeItem> | |
|
30 | #include <QtDeclarative/QDeclarativeParserStatus> | |
|
31 | #endif | |
|
27 | 32 | |
|
28 | 33 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
29 | 34 | class QPieSlice; |
|
30 | 35 | |
|
31 | 36 | class DeclarativePieSeries : public QPieSeries, public QDeclarativeParserStatus |
|
32 | 37 | { |
|
33 | 38 | Q_OBJECT |
|
34 | 39 | Q_INTERFACES(QDeclarativeParserStatus) |
|
35 | 40 | Q_PROPERTY(QDeclarativeListProperty<QObject> seriesChildren READ seriesChildren) |
|
36 | 41 | Q_CLASSINFO("DefaultProperty", "seriesChildren") |
|
37 | 42 | |
|
38 | 43 | public: |
|
39 | 44 | explicit DeclarativePieSeries(QDeclarativeItem *parent = 0); |
|
40 | 45 | QDeclarativeListProperty<QObject> seriesChildren(); |
|
41 | 46 | Q_INVOKABLE QPieSlice *at(int index); |
|
42 | 47 | Q_INVOKABLE QPieSlice *find(QString label); |
|
43 | 48 | Q_INVOKABLE QPieSlice *append(QString label, qreal value); |
|
44 | 49 | Q_INVOKABLE bool remove(QPieSlice *slice); |
|
45 | 50 | Q_INVOKABLE void clear(); |
|
46 | 51 | |
|
47 | 52 | public: |
|
48 | 53 | void classBegin(); |
|
49 | 54 | void componentComplete(); |
|
50 | 55 | |
|
51 | 56 | Q_SIGNALS: |
|
52 | 57 | void sliceAdded(QPieSlice* slice); |
|
53 | 58 | void sliceRemoved(QPieSlice* slice); |
|
54 | 59 | |
|
55 | 60 | public Q_SLOTS: |
|
56 | 61 | static void appendSeriesChildren(QDeclarativeListProperty<QObject> *list, QObject *element); |
|
57 | 62 | void handleAdded(QList<QPieSlice*> slices); |
|
58 | 63 | void handleRemoved(QList<QPieSlice*> slices); |
|
59 | 64 | }; |
|
60 | 65 | |
|
61 | 66 | QTCOMMERCIALCHART_END_NAMESPACE |
|
62 | 67 | |
|
63 | 68 | #endif // DECLARATIVEPIESERIES_H |
@@ -1,82 +1,87 | |||
|
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 DECLARATIVESCATTERSERIES_H |
|
22 | 22 | #define DECLARATIVESCATTERSERIES_H |
|
23 | 23 | |
|
24 | 24 | #include "qscatterseries.h" |
|
25 | 25 | #include "declarativexyseries.h" |
|
26 | #include <QDeclarativeListProperty> | |
|
27 |
#include <QDeclarative |
|
|
26 | #ifdef QT5_QUICK_1 | |
|
27 | #include <QtQuick1/QDeclarativeListProperty> | |
|
28 | #include <QtQuick1/QDeclarativeParserStatus> | |
|
29 | #else | |
|
30 | #include <QtDeclarative/QDeclarativeListProperty> | |
|
31 | #include <QtDeclarative/QDeclarativeParserStatus> | |
|
32 | #endif | |
|
28 | 33 | |
|
29 | 34 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
30 | 35 | |
|
31 | 36 | class DeclarativeScatterSeries : public QScatterSeries, public DeclarativeXySeries, public QDeclarativeParserStatus |
|
32 | 37 | { |
|
33 | 38 | Q_OBJECT |
|
34 | 39 | Q_INTERFACES(QDeclarativeParserStatus) |
|
35 | 40 | Q_PROPERTY(int count READ count NOTIFY countChanged) |
|
36 | 41 | Q_PROPERTY(QAbstractAxis *axisX READ axisX WRITE setAxisX NOTIFY axisXChanged REVISION 1) |
|
37 | 42 | Q_PROPERTY(QAbstractAxis *axisY READ axisY WRITE setAxisY NOTIFY axisYChanged REVISION 1) |
|
38 | 43 | Q_PROPERTY(qreal borderWidth READ borderWidth WRITE setBorderWidth NOTIFY borderWidthChanged REVISION 1) |
|
39 | 44 | Q_PROPERTY(QDeclarativeListProperty<QObject> declarativeChildren READ declarativeChildren) |
|
40 | 45 | Q_CLASSINFO("DefaultProperty", "declarativeChildren") |
|
41 | 46 | |
|
42 | 47 | public: |
|
43 | 48 | explicit DeclarativeScatterSeries(QObject *parent = 0); |
|
44 | 49 | QXYSeries *xySeries() { return this; } |
|
45 | 50 | QAbstractAxis *axisX() { return m_axisX; } |
|
46 | 51 | void setAxisX(QAbstractAxis *axis) { m_axisX = axis; emit axisXChanged(axis); } |
|
47 | 52 | QAbstractAxis *axisY() { return m_axisY; } |
|
48 | 53 | void setAxisY(QAbstractAxis *axis) { m_axisY = axis; emit axisYChanged(axis); } |
|
49 | 54 | qreal borderWidth() const; |
|
50 | 55 | void setBorderWidth(qreal borderWidth); |
|
51 | 56 | QDeclarativeListProperty<QObject> declarativeChildren(); |
|
52 | 57 | |
|
53 | 58 | public: // from QDeclarativeParserStatus |
|
54 | 59 | void classBegin() { DeclarativeXySeries::classBegin(); } |
|
55 | 60 | void componentComplete() { DeclarativeXySeries::componentComplete(); } |
|
56 | 61 | |
|
57 | 62 | public: |
|
58 | 63 | Q_INVOKABLE void append(qreal x, qreal y) { DeclarativeXySeries::append(x, y); } |
|
59 | 64 | Q_INVOKABLE void replace(qreal oldX, qreal oldY, qreal newX, qreal newY) { DeclarativeXySeries::replace(oldX, oldY, newX, newY); } |
|
60 | 65 | Q_INVOKABLE void remove(qreal x, qreal y) { DeclarativeXySeries::remove(x, y); } |
|
61 | 66 | Q_INVOKABLE void insert(int index, qreal x, qreal y) { DeclarativeXySeries::insert(index, x, y); } |
|
62 | 67 | Q_INVOKABLE void clear() { DeclarativeXySeries::clear(); } |
|
63 | 68 | Q_INVOKABLE QPointF at(int index) { return DeclarativeXySeries::at(index); } |
|
64 | 69 | |
|
65 | 70 | Q_SIGNALS: |
|
66 | 71 | void countChanged(int count); |
|
67 | 72 | Q_REVISION(1) void axisXChanged(QAbstractAxis *axis); |
|
68 | 73 | Q_REVISION(1) void axisYChanged(QAbstractAxis *axis); |
|
69 | 74 | Q_REVISION(1) void borderWidthChanged(qreal width); |
|
70 | 75 | |
|
71 | 76 | public Q_SLOTS: |
|
72 | 77 | static void appendDeclarativeChildren(QDeclarativeListProperty<QObject> *list, QObject *element); |
|
73 | 78 | void handleCountChanged(int index); |
|
74 | 79 | |
|
75 | 80 | private: |
|
76 | 81 | QAbstractAxis *m_axisX; |
|
77 | 82 | QAbstractAxis *m_axisY; |
|
78 | 83 | }; |
|
79 | 84 | |
|
80 | 85 | QTCOMMERCIALCHART_END_NAMESPACE |
|
81 | 86 | |
|
82 | 87 | #endif // DECLARATIVESCATTERSERIES_H |
@@ -1,90 +1,95 | |||
|
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 DECLARATIVESPLINESERIES_H |
|
22 | 22 | #define DECLARATIVESPLINESERIES_H |
|
23 | 23 | |
|
24 | 24 | #include "qsplineseries.h" |
|
25 | 25 | #include "declarativexyseries.h" |
|
26 | #include <QDeclarativeParserStatus> | |
|
27 | #include <QDeclarativeListProperty> | |
|
26 | #ifdef QT5_QUICK_1 | |
|
27 | #include <QtQuick1/QDeclarativeListProperty> | |
|
28 | #include <QtQuick1/QDeclarativeParserStatus> | |
|
29 | #else | |
|
30 | #include <QtDeclarative/QDeclarativeListProperty> | |
|
31 | #include <QtDeclarative/QDeclarativeParserStatus> | |
|
32 | #endif | |
|
28 | 33 | |
|
29 | 34 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
30 | 35 | |
|
31 | 36 | class DeclarativeSplineSeries : public QSplineSeries, public DeclarativeXySeries, public QDeclarativeParserStatus |
|
32 | 37 | { |
|
33 | 38 | Q_OBJECT |
|
34 | 39 | Q_INTERFACES(QDeclarativeParserStatus) |
|
35 | 40 | Q_PROPERTY(int count READ count NOTIFY countChanged) |
|
36 | 41 | Q_PROPERTY(QAbstractAxis *axisX READ axisX WRITE setAxisX NOTIFY axisXChanged REVISION 1) |
|
37 | 42 | Q_PROPERTY(QAbstractAxis *axisY READ axisY WRITE setAxisY NOTIFY axisYChanged REVISION 1) |
|
38 | 43 | Q_PROPERTY(qreal width READ width WRITE setWidth NOTIFY widthChanged REVISION 1) |
|
39 | 44 | Q_PROPERTY(Qt::PenStyle style READ style WRITE setStyle NOTIFY styleChanged REVISION 1) |
|
40 | 45 | Q_PROPERTY(Qt::PenCapStyle capStyle READ capStyle WRITE setCapStyle NOTIFY capStyleChanged REVISION 1) |
|
41 | 46 | Q_PROPERTY(QDeclarativeListProperty<QObject> declarativeChildren READ declarativeChildren) |
|
42 | 47 | Q_CLASSINFO("DefaultProperty", "declarativeChildren") |
|
43 | 48 | |
|
44 | 49 | public: |
|
45 | 50 | explicit DeclarativeSplineSeries(QObject *parent = 0); |
|
46 | 51 | QXYSeries *xySeries() { return this; } |
|
47 | 52 | QAbstractAxis *axisX() { return m_axisX; } |
|
48 | 53 | void setAxisX(QAbstractAxis *axis) { m_axisX = axis; emit axisXChanged(axis); } |
|
49 | 54 | QAbstractAxis *axisY() { return m_axisY; } |
|
50 | 55 | void setAxisY(QAbstractAxis *axis) { m_axisY = axis; emit axisYChanged(axis); } |
|
51 | 56 | qreal width() const; |
|
52 | 57 | void setWidth(qreal width); |
|
53 | 58 | Qt::PenStyle style() const; |
|
54 | 59 | void setStyle(Qt::PenStyle style); |
|
55 | 60 | Qt::PenCapStyle capStyle() const; |
|
56 | 61 | void setCapStyle(Qt::PenCapStyle capStyle); |
|
57 | 62 | QDeclarativeListProperty<QObject> declarativeChildren(); |
|
58 | 63 | |
|
59 | 64 | public: // from QDeclarativeParserStatus |
|
60 | 65 | void classBegin() { DeclarativeXySeries::classBegin(); } |
|
61 | 66 | void componentComplete() { DeclarativeXySeries::componentComplete(); } |
|
62 | 67 | |
|
63 | 68 | public: |
|
64 | 69 | Q_INVOKABLE void append(qreal x, qreal y) { DeclarativeXySeries::append(x, y); } |
|
65 | 70 | Q_INVOKABLE void replace(qreal oldX, qreal oldY, qreal newX, qreal newY) { DeclarativeXySeries::replace(oldX, oldY, newX, newY); } |
|
66 | 71 | Q_INVOKABLE void remove(qreal x, qreal y) { DeclarativeXySeries::remove(x, y); } |
|
67 | 72 | Q_INVOKABLE void insert(int index, qreal x, qreal y) { DeclarativeXySeries::insert(index, x, y); } |
|
68 | 73 | Q_INVOKABLE void clear() { DeclarativeXySeries::clear(); } |
|
69 | 74 | Q_INVOKABLE QPointF at(int index) { return DeclarativeXySeries::at(index); } |
|
70 | 75 | |
|
71 | 76 | Q_SIGNALS: |
|
72 | 77 | void countChanged(int count); |
|
73 | 78 | Q_REVISION(1) void axisXChanged(QAbstractAxis *axis); |
|
74 | 79 | Q_REVISION(1) void axisYChanged(QAbstractAxis *axis); |
|
75 | 80 | Q_REVISION(1) void widthChanged(qreal width); |
|
76 | 81 | Q_REVISION(1) void styleChanged(Qt::PenStyle style); |
|
77 | 82 | Q_REVISION(1) void capStyleChanged(Qt::PenCapStyle capStyle); |
|
78 | 83 | |
|
79 | 84 | public Q_SLOTS: |
|
80 | 85 | static void appendDeclarativeChildren(QDeclarativeListProperty<QObject> *list, QObject *element); |
|
81 | 86 | void handleCountChanged(int index); |
|
82 | 87 | |
|
83 | 88 | public: |
|
84 | 89 | QAbstractAxis *m_axisX; |
|
85 | 90 | QAbstractAxis *m_axisY; |
|
86 | 91 | }; |
|
87 | 92 | |
|
88 | 93 | QTCOMMERCIALCHART_END_NAMESPACE |
|
89 | 94 | |
|
90 | 95 | #endif // DECLARATIVESPLINESERIES_H |
@@ -1,165 +1,177 | |||
|
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 | #include <QtDeclarative/qdeclarativeextensionplugin.h> | |
|
22 |
#include <Qt |
|
|
21 | #ifdef QT5_QUICK_1 | |
|
22 | #include <QtQuick1/qdeclarativeextensionplugin.h> | |
|
23 | #include <QtQuick1/qdeclarative.h> | |
|
24 | #else | |
|
25 | #include <QtDeclarative/qdeclarativeextensionplugin.h> | |
|
26 | #include <QtDeclarative/qdeclarative.h> | |
|
27 | #endif | |
|
23 | 28 | #include "qchart.h" |
|
24 | 29 | #include "qabstractaxis.h" |
|
25 | 30 | #include "qvalueaxis.h" |
|
26 | 31 | #include "declarativecategoryaxis.h" |
|
27 | 32 | #include "qbarcategoryaxis.h" |
|
28 | 33 | #include "declarativechart.h" |
|
29 | 34 | #include "declarativexypoint.h" |
|
30 | 35 | #include "declarativelineseries.h" |
|
31 | 36 | #include "declarativesplineseries.h" |
|
32 | 37 | #include "declarativeareaseries.h" |
|
33 | 38 | #include "declarativescatterseries.h" |
|
34 | 39 | #include "declarativebarseries.h" |
|
35 | 40 | #include "declarativepieseries.h" |
|
36 | 41 | #include "qvxymodelmapper.h" |
|
37 | 42 | #include "qhxymodelmapper.h" |
|
38 | 43 | #include "qhpiemodelmapper.h" |
|
39 | 44 | #include "qvpiemodelmapper.h" |
|
40 | 45 | #include "qhbarmodelmapper.h" |
|
41 | 46 | #include "qvbarmodelmapper.h" |
|
42 | 47 | #include "declarativemargins.h" |
|
43 | 48 | #include <QAbstractItemModel> |
|
44 | 49 | |
|
45 | 50 | #ifndef QT_ON_ARM |
|
46 | 51 | #include "qdatetimeaxis.h" |
|
47 | 52 | #endif |
|
48 | 53 | |
|
49 | 54 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
50 | 55 | |
|
51 | 56 | class ChartQmlPlugin : public QDeclarativeExtensionPlugin |
|
52 | 57 | { |
|
53 | 58 | Q_OBJECT |
|
59 | ||
|
60 | #ifdef QT5_QUICK_1 | |
|
61 | Q_PLUGIN_METADATA(IID "org.qt-project.foo") | |
|
62 | #endif | |
|
63 | ||
|
54 | 64 | public: |
|
55 | 65 | virtual void registerTypes(const char *uri) |
|
56 | 66 | { |
|
57 | 67 | Q_ASSERT(QLatin1String(uri) == QLatin1String("QtCommercial.Chart")); |
|
58 | 68 | |
|
59 | 69 | // QtCommercial.Chart 1.0 |
|
60 | 70 | qmlRegisterType<DeclarativeChart>(uri, 1, 0, "ChartView"); |
|
61 | 71 | qmlRegisterType<DeclarativeXYPoint>(uri, 1, 0, "XYPoint"); |
|
62 | 72 | qmlRegisterType<DeclarativeScatterSeries>(uri, 1, 0, "ScatterSeries"); |
|
63 | 73 | qmlRegisterType<DeclarativeLineSeries>(uri, 1, 0, "LineSeries"); |
|
64 | 74 | qmlRegisterType<DeclarativeSplineSeries>(uri, 1, 0, "SplineSeries"); |
|
65 | 75 | qmlRegisterType<DeclarativeAreaSeries>(uri, 1, 0, "AreaSeries"); |
|
66 | 76 | qmlRegisterType<DeclarativeBarSeries>(uri, 1, 0, "BarSeries"); |
|
67 | 77 | qmlRegisterType<DeclarativeStackedBarSeries>(uri, 1, 0, "StackedBarSeries"); |
|
68 | 78 | qmlRegisterType<DeclarativePercentBarSeries>(uri, 1, 0, "PercentBarSeries"); |
|
69 | 79 | qmlRegisterType<DeclarativePieSeries>(uri, 1, 0, "PieSeries"); |
|
70 | 80 | qmlRegisterType<QPieSlice>(uri, 1, 0, "PieSlice"); |
|
71 | 81 | qmlRegisterType<DeclarativeBarSet>(uri, 1, 0, "BarSet"); |
|
72 | 82 | qmlRegisterType<QHXYModelMapper>(uri, 1, 0, "HXYModelMapper"); |
|
73 | 83 | qmlRegisterType<QVXYModelMapper>(uri, 1, 0, "VXYModelMapper"); |
|
74 | 84 | qmlRegisterType<QHPieModelMapper>(uri, 1, 0, "HPieModelMapper"); |
|
75 | 85 | qmlRegisterType<QVPieModelMapper>(uri, 1, 0, "VPieModelMapper"); |
|
76 | 86 | qmlRegisterType<QHBarModelMapper>(uri, 1, 0, "HBarModelMapper"); |
|
77 | 87 | qmlRegisterType<QVBarModelMapper>(uri, 1, 0, "VBarModelMapper"); |
|
78 | 88 | qmlRegisterType<QValueAxis>(uri, 1, 0, "ValuesAxis"); |
|
79 | 89 | qmlRegisterType<QBarCategoryAxis>(uri, 1, 0, "BarCategoriesAxis"); |
|
80 | 90 | qmlRegisterUncreatableType<QLegend>(uri, 1, 0, "Legend", |
|
81 | 91 | QLatin1String("Trying to create uncreatable: Legend.")); |
|
82 | 92 | qmlRegisterUncreatableType<QXYSeries>(uri, 1, 0, "XYSeries", |
|
83 | 93 | QLatin1String("Trying to create uncreatable: XYSeries.")); |
|
84 | 94 | qmlRegisterUncreatableType<QAbstractItemModel>(uri, 1, 0, "AbstractItemModel", |
|
85 | 95 | QLatin1String("Trying to create uncreatable: AbstractItemModel.")); |
|
86 | 96 | qmlRegisterUncreatableType<QXYModelMapper>(uri, 1, 0, "XYModelMapper", |
|
87 | 97 | QLatin1String("Trying to create uncreatable: XYModelMapper.")); |
|
88 | 98 | qmlRegisterUncreatableType<QPieModelMapper>(uri, 1, 0, "PieModelMapper", |
|
89 | 99 | QLatin1String("Trying to create uncreatable: PieModelMapper.")); |
|
90 | 100 | qmlRegisterUncreatableType<QBarModelMapper>(uri, 1, 0, "BarModelMapper", |
|
91 | 101 | QLatin1String("Trying to create uncreatable: BarModelMapper.")); |
|
92 | 102 | qmlRegisterUncreatableType<QAbstractSeries>(uri, 1, 0, "AbstractSeries", |
|
93 | 103 | QLatin1String("Trying to create uncreatable: AbstractSeries.")); |
|
94 | 104 | qmlRegisterUncreatableType<QAbstractBarSeries>(uri, 1, 0, "AbstractBarSeries", |
|
95 | 105 | QLatin1String("Trying to create uncreatable: AbstractBarSeries.")); |
|
96 | 106 | qmlRegisterUncreatableType<QAbstractAxis>(uri, 1, 0, "AbstractAxis", |
|
97 | 107 | QLatin1String("Trying to create uncreatable: AbstractAxis. Use specific types of axis instead.")); |
|
98 | 108 | qmlRegisterUncreatableType<QBarSet>(uri, 1, 0, "BarSetBase", |
|
99 | 109 | QLatin1String("Trying to create uncreatable: BarsetBase.")); |
|
100 | 110 | qmlRegisterUncreatableType<QPieSeries>(uri, 1, 0, "QPieSeries", |
|
101 | 111 | QLatin1String("Trying to create uncreatable: QPieSeries. Use PieSeries instead.")); |
|
102 | 112 | |
|
103 | 113 | // QtCommercial.Chart 1.1 |
|
104 | 114 | qmlRegisterType<DeclarativeChart, 1>(uri, 1, 1, "ChartView"); |
|
105 | 115 | qmlRegisterType<DeclarativeXYPoint>(uri, 1, 1, "XYPoint"); |
|
106 | 116 | qmlRegisterType<DeclarativeScatterSeries, 1>(uri, 1, 1, "ScatterSeries"); |
|
107 | 117 | qmlRegisterType<DeclarativeLineSeries, 1>(uri, 1, 1, "LineSeries"); |
|
108 | 118 | qmlRegisterType<DeclarativeSplineSeries, 1>(uri, 1, 1, "SplineSeries"); |
|
109 | 119 | qmlRegisterType<DeclarativeAreaSeries, 1>(uri, 1, 1, "AreaSeries"); |
|
110 | 120 | qmlRegisterType<DeclarativeBarSeries, 1>(uri, 1, 1, "BarSeries"); |
|
111 | 121 | qmlRegisterType<DeclarativeStackedBarSeries, 1>(uri, 1, 1, "StackedBarSeries"); |
|
112 | 122 | qmlRegisterType<DeclarativePercentBarSeries, 1>(uri, 1, 1, "PercentBarSeries"); |
|
113 | 123 | qmlRegisterType<DeclarativeHorizontalBarSeries, 1>(uri, 1, 1, "HorizontalBarSeries"); |
|
114 | 124 | qmlRegisterType<DeclarativeHorizontalStackedBarSeries, 1>(uri, 1, 1, "HorizontalStackedBarSeries"); |
|
115 | 125 | qmlRegisterType<DeclarativeHorizontalPercentBarSeries, 1>(uri, 1, 1, "HorizontalPercentBarSeries"); |
|
116 | 126 | qmlRegisterType<DeclarativePieSeries>(uri, 1, 1, "PieSeries"); |
|
117 | 127 | qmlRegisterType<QPieSlice>(uri, 1, 1, "PieSlice"); |
|
118 | 128 | qmlRegisterType<DeclarativeBarSet>(uri, 1, 1, "BarSet"); |
|
119 | 129 | qmlRegisterType<QHXYModelMapper>(uri, 1, 1, "HXYModelMapper"); |
|
120 | 130 | qmlRegisterType<QVXYModelMapper>(uri, 1, 1, "VXYModelMapper"); |
|
121 | 131 | qmlRegisterType<QHPieModelMapper>(uri, 1, 1, "HPieModelMapper"); |
|
122 | 132 | qmlRegisterType<QVPieModelMapper>(uri, 1, 1, "VPieModelMapper"); |
|
123 | 133 | qmlRegisterType<QHBarModelMapper>(uri, 1, 1, "HBarModelMapper"); |
|
124 | 134 | qmlRegisterType<QVBarModelMapper>(uri, 1, 1, "VBarModelMapper"); |
|
125 | 135 | qmlRegisterType<QValueAxis>(uri, 1, 1, "ValueAxis"); |
|
126 | 136 | #ifndef QT_ON_ARM |
|
127 | 137 | qmlRegisterType<QDateTimeAxis>(uri, 1, 1, "DateTimeAxis"); |
|
128 | 138 | #endif |
|
129 | 139 | qmlRegisterType<DeclarativeCategoryAxis>(uri, 1, 1, "CategoryAxis"); |
|
130 | 140 | qmlRegisterType<DeclarativeCategoryRange>(uri, 1, 1, "CategoryRange"); |
|
131 | 141 | qmlRegisterType<QBarCategoryAxis>(uri, 1, 1, "BarCategoryAxis"); |
|
132 | 142 | qmlRegisterUncreatableType<QLegend>(uri, 1, 1, "Legend", |
|
133 | 143 | QLatin1String("Trying to create uncreatable: Legend.")); |
|
134 | 144 | qmlRegisterUncreatableType<QXYSeries>(uri, 1, 1, "XYSeries", |
|
135 | 145 | QLatin1String("Trying to create uncreatable: XYSeries.")); |
|
136 | 146 | qmlRegisterUncreatableType<QAbstractItemModel>(uri, 1, 1, "AbstractItemModel", |
|
137 | 147 | QLatin1String("Trying to create uncreatable: AbstractItemModel.")); |
|
138 | 148 | qmlRegisterUncreatableType<QXYModelMapper>(uri, 1, 1, "XYModelMapper", |
|
139 | 149 | QLatin1String("Trying to create uncreatable: XYModelMapper.")); |
|
140 | 150 | qmlRegisterUncreatableType<QPieModelMapper>(uri, 1, 1, "PieModelMapper", |
|
141 | 151 | QLatin1String("Trying to create uncreatable: PieModelMapper.")); |
|
142 | 152 | qmlRegisterUncreatableType<QBarModelMapper>(uri, 1, 1, "BarModelMapper", |
|
143 | 153 | QLatin1String("Trying to create uncreatable: BarModelMapper.")); |
|
144 | 154 | qmlRegisterUncreatableType<QAbstractSeries>(uri, 1, 1, "AbstractSeries", |
|
145 | 155 | QLatin1String("Trying to create uncreatable: AbstractSeries.")); |
|
146 | 156 | qmlRegisterUncreatableType<QAbstractBarSeries>(uri, 1, 1, "AbstractBarSeries", |
|
147 | 157 | QLatin1String("Trying to create uncreatable: AbstractBarSeries.")); |
|
148 | 158 | qmlRegisterUncreatableType<QAbstractAxis>(uri, 1, 1, "AbstractAxis", |
|
149 | 159 | QLatin1String("Trying to create uncreatable: AbstractAxis. Use specific types of axis instead.")); |
|
150 | 160 | qmlRegisterUncreatableType<QBarSet>(uri, 1, 1, "BarSetBase", |
|
151 | 161 | QLatin1String("Trying to create uncreatable: BarsetBase.")); |
|
152 | 162 | qmlRegisterUncreatableType<QPieSeries>(uri, 1, 1, "QPieSeries", |
|
153 | 163 | QLatin1String("Trying to create uncreatable: QPieSeries. Use PieSeries instead.")); |
|
154 | 164 | qmlRegisterUncreatableType<DeclarativeMargins>(uri, 1, 1, "Margins", |
|
155 | 165 | QLatin1String("Trying to create uncreatable: Margins.")); |
|
156 | 166 | } |
|
157 | 167 | }; |
|
158 | 168 | |
|
159 | 169 | #include "plugin.moc" |
|
160 | 170 | |
|
161 | 171 | QTCOMMERCIALCHART_END_NAMESPACE |
|
162 | 172 | |
|
163 | 173 | QTCOMMERCIALCHART_USE_NAMESPACE |
|
164 | 174 | |
|
165 | Q_EXPORT_PLUGIN2(qtcommercialchartqml, QT_PREPEND_NAMESPACE(ChartQmlPlugin)) | |
|
175 | #ifndef QT5_QUICK_1 | |
|
176 | Q_EXPORT_PLUGIN2(qtcommercialchartqml, QT_PREPEND_NAMESPACE(ChartQmlPlugin)) | |
|
177 | #endif |
@@ -1,16 +1,16 | |||
|
1 | 1 | !include( ../config.pri ) { |
|
2 | 2 | error( "Couldn't find the config.pri file!" ) |
|
3 | 3 | } |
|
4 | 4 | |
|
5 | 5 | TEMPLATE = subdirs |
|
6 | 6 | |
|
7 | 7 | contains(QT_VERSION, ^4\\.[0-7]\\.[0-3]\\s*$) | contains(QT_VERSION, ^4\\.[0-6]\\..*) { |
|
8 | 8 | warning("QtCommercial.Charts QML API requires at least Qt 4.7.4. You are using $${QT_VERSION} so the QML API is disabled.") |
|
9 | 9 | } else { |
|
10 | 10 | SUBDIRS += declarative |
|
11 | 11 | } |
|
12 | 12 | |
|
13 | 13 | !linux-arm*: { |
|
14 | SUBDIRS += \ | |
|
15 | designer | |
|
14 | # SUBDIRS += \ | |
|
15 | # designer | |
|
16 | 16 | } |
@@ -1,254 +1,254 | |||
|
1 | 1 | !include( ../config.pri ):error( "Couldn't find the config.pri file!" ) |
|
2 | 2 | |
|
3 | 3 | ############################# BUILD CONFIG ###################################### |
|
4 | 4 | |
|
5 | 5 | TARGET = $$LIBRARY_NAME |
|
6 | 6 | DESTDIR = $$CHART_BUILD_LIB_DIR |
|
7 | 7 | TEMPLATE = lib |
|
8 | 8 | QT = core gui |
|
9 | 9 | greaterThan(QT_MAJOR_VERSION, 4): QT += widgets |
|
10 | 10 | DEFINES += QTCOMMERCIALCHART_LIBRARY |
|
11 | 11 | win32:CONFIG += create_prl |
|
12 | 12 | # treat warnings as errors |
|
13 | 13 | win32-msvc*: { |
|
14 | 14 | QMAKE_CXXFLAGS += /WX |
|
15 | 15 | } else { |
|
16 |
QMAKE_CXXFLAGS += -Werror |
|
|
16 | # QMAKE_CXXFLAGS += -Werror | |
|
17 | 17 | } |
|
18 | 18 | |
|
19 | 19 | unix:{ |
|
20 | 20 | QMAKE_CXXFLAGS += -fvisibility=hidden -fvisibility-inlines-hidden |
|
21 | 21 | } |
|
22 | 22 | |
|
23 | 23 | ############################# DEPEDENCES ######################################## |
|
24 | 24 | |
|
25 | 25 | win32-msvc*: LIBS += User32.lib |
|
26 | 26 | LIBS -= -l$$LIBRARY_NAME |
|
27 | 27 | INCLUDEPATH += ../include . |
|
28 | 28 | |
|
29 | 29 | ############################# SOURCES ########################################## |
|
30 | 30 | |
|
31 | 31 | SOURCES += \ |
|
32 | 32 | $$PWD/chartdataset.cpp \ |
|
33 | 33 | $$PWD/chartpresenter.cpp \ |
|
34 | 34 | $$PWD/charttheme.cpp \ |
|
35 | 35 | $$PWD/domain.cpp \ |
|
36 | 36 | $$PWD/qchart.cpp \ |
|
37 | 37 | $$PWD/qchartview.cpp \ |
|
38 | 38 | $$PWD/qabstractseries.cpp \ |
|
39 | 39 | $$PWD/chartbackground.cpp \ |
|
40 | 40 | $$PWD/chartelement.cpp \ |
|
41 | 41 | $$PWD/scroller.cpp \ |
|
42 | 42 | $$PWD/chartlayout.cpp \ |
|
43 | 43 | $$PWD/charttitle.cpp |
|
44 | 44 | PRIVATE_HEADERS += \ |
|
45 | 45 | $$PWD/chartdataset_p.h \ |
|
46 | 46 | $$PWD/chartitem_p.h \ |
|
47 | 47 | $$PWD/chartpresenter_p.h \ |
|
48 | 48 | $$PWD/charttheme_p.h \ |
|
49 | 49 | $$PWD/domain_p.h \ |
|
50 | 50 | $$PWD/chartbackground_p.h \ |
|
51 | 51 | $$PWD/chartelement_p.h \ |
|
52 | 52 | $$PWD/chartconfig_p.h \ |
|
53 | 53 | $$PWD/qchart_p.h \ |
|
54 | 54 | $$PWD/qchartview_p.h \ |
|
55 | 55 | $$PWD/scroller_p.h \ |
|
56 | 56 | $$PWD/qabstractseries_p.h \ |
|
57 | 57 | $$PWD/chartlayout_p.h \ |
|
58 | 58 | $$PWD/charttitle_p.h |
|
59 | 59 | PUBLIC_HEADERS += \ |
|
60 | 60 | $$PWD/qchart.h \ |
|
61 | 61 | $$PWD/qchartglobal.h \ |
|
62 | 62 | $$PWD/qabstractseries.h \ |
|
63 | 63 | $$PWD/qchartview.h \ |
|
64 | 64 | $$PWD/chartsnamespace.h |
|
65 | 65 | |
|
66 | 66 | include(animations/animations.pri) |
|
67 | 67 | include(areachart/areachart.pri) |
|
68 | 68 | include(axis/axis.pri) |
|
69 | 69 | include(barchart/barchart.pri) |
|
70 | 70 | include(legend/legend.pri) |
|
71 | 71 | include(linechart/linechart.pri) |
|
72 | 72 | include(piechart/piechart.pri) |
|
73 | 73 | include(scatterchart/scatter.pri) |
|
74 | 74 | include(splinechart/splinechart.pri) |
|
75 | 75 | include(themes/themes.pri) |
|
76 | 76 | include(xychart/xychart.pri) |
|
77 | 77 | |
|
78 | 78 | HEADERS += $$PUBLIC_HEADERS |
|
79 | 79 | HEADERS += $$PRIVATE_HEADERS |
|
80 | 80 | HEADERS += $$THEMES |
|
81 | 81 | |
|
82 | 82 | ############################# BUILD PATH ########################################## |
|
83 | 83 | |
|
84 | 84 | OBJECTS_DIR = $$CHART_BUILD_DIR/lib |
|
85 | 85 | MOC_DIR = $$CHART_BUILD_DIR/lib |
|
86 | 86 | UI_DIR = $$CHART_BUILD_DIR/lib |
|
87 | 87 | RCC_DIR = $$CHART_BUILD_DIR/lib |
|
88 | 88 | |
|
89 | 89 | ############################# PUBLIC HEADERS GENERATOR ########################################## |
|
90 | 90 | |
|
91 | 91 | !exists($$CHART_BUILD_PUBLIC_HEADER_DIR/QChartGlobal) |
|
92 | 92 | { |
|
93 | 93 | system($$QMAKE_MKDIR $$CHART_BUILD_PUBLIC_HEADER_DIR) |
|
94 | 94 | win32:{ |
|
95 | 95 | command = "echo $${LITERAL_HASH}include \"qchartglobal.h\" > $$CHART_BUILD_PUBLIC_HEADER_DIR/QChartGlobal" |
|
96 | 96 | }else{ |
|
97 | 97 | command = "echo \"$${LITERAL_HASH}include \\\"qchartglobal.h\\\"\" > $$CHART_BUILD_PUBLIC_HEADER_DIR/QChartGlobal" |
|
98 | 98 | } |
|
99 | 99 | PUBLIC_QT_HEADERS += $$CHART_BUILD_PUBLIC_HEADER_DIR/QChartGlobal |
|
100 | 100 | system($$command) |
|
101 | 101 | } |
|
102 | 102 | |
|
103 | 103 | for(file, PUBLIC_HEADERS) { |
|
104 | 104 | name = $$split(file,'/') |
|
105 | 105 | name = $$last(name) |
|
106 | 106 | class = "$$cat($$file)" |
|
107 | 107 | class = $$find(class,class) |
|
108 | 108 | !isEmpty(class){ |
|
109 | 109 | class = $$split(class,QTCOMMERCIALCHART_EXPORT) |
|
110 | 110 | class = $$member(class,1) |
|
111 | 111 | class = $$split(class,' ') |
|
112 | 112 | class = $$replace(class,' ','') |
|
113 | 113 | class = $$member(class,0) |
|
114 | 114 | win32:{ |
|
115 | 115 | command = "echo $${LITERAL_HASH}include \"$$name\" > $$CHART_BUILD_PUBLIC_HEADER_DIR/$$class" |
|
116 | 116 | }else{ |
|
117 | 117 | command = "echo \"$${LITERAL_HASH}include \\\"$$name\\\"\" > $$CHART_BUILD_PUBLIC_HEADER_DIR/$$class" |
|
118 | 118 | } |
|
119 | 119 | PUBLIC_QT_HEADERS += $$CHART_BUILD_PUBLIC_HEADER_DIR/$$class |
|
120 | 120 | system($$command) |
|
121 | 121 | } |
|
122 | 122 | } |
|
123 | 123 | |
|
124 | 124 | ############################# INSTALLERS ########################################## |
|
125 | 125 | |
|
126 | 126 | public_headers.path = $$[QT_INSTALL_HEADERS]/QtCommercialChart |
|
127 | 127 | public_headers.files = $$PUBLIC_HEADERS $$PUBLIC_QT_HEADERS |
|
128 | 128 | INSTALLS += public_headers |
|
129 | 129 | |
|
130 | 130 | install_build_public_headers.name = build_public_headers |
|
131 | 131 | install_build_public_headers.output = $$CHART_BUILD_PUBLIC_HEADER_DIR/${QMAKE_FILE_BASE}.h |
|
132 | 132 | install_build_public_headers.input = PUBLIC_HEADERS |
|
133 | 133 | install_build_public_headers.commands = $$QMAKE_COPY \ |
|
134 | 134 | ${QMAKE_FILE_NAME} \ |
|
135 | 135 | $$CHART_BUILD_PUBLIC_HEADER_DIR |
|
136 | 136 | install_build_public_headers.CONFIG += target_predeps \ |
|
137 | 137 | no_link |
|
138 | 138 | |
|
139 | 139 | install_build_private_headers.name = build_private_headers |
|
140 | 140 | install_build_private_headers.output = $$CHART_BUILD_PRIVATE_HEADER_DIR/${QMAKE_FILE_BASE}.h |
|
141 | 141 | install_build_private_headers.input = PRIVATE_HEADERS |
|
142 | 142 | install_build_private_headers.commands = $$QMAKE_COPY \ |
|
143 | 143 | ${QMAKE_FILE_NAME} \ |
|
144 | 144 | $$CHART_BUILD_PRIVATE_HEADER_DIR |
|
145 | 145 | install_build_private_headers.CONFIG += target_predeps \ |
|
146 | 146 | no_link |
|
147 | 147 | |
|
148 | 148 | QMAKE_EXTRA_COMPILERS += install_build_public_headers \ |
|
149 | 149 | install_build_private_headers \ |
|
150 | 150 | |
|
151 | 151 | win32:{ |
|
152 | 152 | bintarget.CONFIG += no_check_exist |
|
153 | 153 | !staticlib: { |
|
154 | 154 | bintarget.files += $$CHART_BUILD_LIB_DIR\\$${TARGET}.dll |
|
155 | 155 | } |
|
156 | 156 | win32-msvc*:CONFIG(debug, debug|release): { |
|
157 | 157 | bintarget.files += $$CHART_BUILD_LIB_DIR\\$${TARGET}.pdb |
|
158 | 158 | } |
|
159 | 159 | bintarget.path = $$[QT_INSTALL_BINS] |
|
160 | 160 | |
|
161 | 161 | libtarget.CONFIG += no_check_exist |
|
162 | 162 | libtarget.files = $$CHART_BUILD_LIB_DIR\\$${TARGET}.prl |
|
163 | 163 | win32-msvc*: { |
|
164 | 164 | libtarget.files += $$CHART_BUILD_LIB_DIR\\$${TARGET}.lib |
|
165 | 165 | } else { |
|
166 | 166 | libtarget.files += $$CHART_BUILD_LIB_DIR\\lib$${TARGET}.a |
|
167 | 167 | } |
|
168 | 168 | libtarget.path = $$[QT_INSTALL_LIBS] |
|
169 | 169 | |
|
170 | 170 | DLLDESTDIR = $$CHART_BUILD_BIN_DIR |
|
171 | 171 | INSTALLS += bintarget libtarget |
|
172 | 172 | }else{ |
|
173 | 173 | target.path=$$[QT_INSTALL_LIBS] |
|
174 | 174 | INSTALLS += target |
|
175 | 175 | } |
|
176 | 176 | |
|
177 | 177 | mac: !staticlib: { |
|
178 | 178 | # Update the name (id) of the library on OSX to point to the lib path |
|
179 | 179 | MAC_CHARTS_LIB_NAME = "lib"$$LIBRARY_NAME".1.dylib" |
|
180 | 180 | QMAKE_POST_LINK += "install_name_tool -id $$CHART_BUILD_LIB_DIR"/"$$MAC_CHARTS_LIB_NAME $$CHART_BUILD_LIB_DIR"/"$$MAC_CHARTS_LIB_NAME" |
|
181 | 181 | |
|
182 | 182 | # Update the name (id) of the installed library on OSX to point to the installation path |
|
183 | 183 | postinstall.path = $$[QT_INSTALL_LIBS] |
|
184 | 184 | postinstall.extra = "install_name_tool -id $$[QT_INSTALL_LIBS]"/"$$MAC_CHARTS_LIB_NAME $$[QT_INSTALL_LIBS]"/"$$MAC_CHARTS_LIB_NAME" |
|
185 | 185 | INSTALLS += postinstall |
|
186 | 186 | } |
|
187 | 187 | |
|
188 | 188 | ################################ DEVELOPMENT BUILD ########################################## |
|
189 | 189 | # There is a problem with jom.exe currently. It does not seem to understand QMAKE_EXTRA_TARGETS properly. |
|
190 | 190 | # This is the case at least with shadow builds. |
|
191 | 191 | # http://qt-project.org/wiki/jom |
|
192 | 192 | |
|
193 | 193 | development_build:!win32-msvc*:{ |
|
194 | 194 | chartversion.target = $$PWD/qchartversion_p.h |
|
195 | 195 | |
|
196 | 196 | unix:{ |
|
197 | 197 | chartversion.commands = @echo \ |
|
198 | 198 | \" $${LITERAL_HASH}ifndef QCHARTVERSION_P_H\\n\ |
|
199 | 199 | $${LITERAL_HASH}define QCHARTVERSION_P_H\\n\ |
|
200 | 200 | const char *buildTime = \\\"`date +'%y%m%d%H%M'`\\\" ; \\n\ |
|
201 | 201 | const char *gitHead = \\\"`git rev-parse HEAD`\\\" ; \\n \ |
|
202 | 202 | $${LITERAL_HASH}endif \" \ |
|
203 | 203 | > \ |
|
204 | 204 | $$chartversion.target; |
|
205 | 205 | }else{ |
|
206 | 206 | chartversion.commands = @echo \ |
|
207 | 207 | "const char *buildTime = \"%date%_%time%\" ; \ |
|
208 | 208 | const char *gitHead = \"unknown\" ; " \ |
|
209 | 209 | > \ |
|
210 | 210 | $$chartversion.target |
|
211 | 211 | } |
|
212 | 212 | |
|
213 | 213 | chartversion.depends = $$HEADERS \ |
|
214 | 214 | $$SOURCES |
|
215 | 215 | |
|
216 | 216 | PRE_TARGETDEPS += $$chartversion.target |
|
217 | 217 | QMAKE_CLEAN += $$PWD/qchartversion_p.h |
|
218 | 218 | QMAKE_EXTRA_TARGETS += chartversion |
|
219 | 219 | } |
|
220 | 220 | |
|
221 | 221 | ############################### CLEAN ########################################### |
|
222 | 222 | |
|
223 | 223 | unix:QMAKE_DISTCLEAN += -r \ |
|
224 | 224 | $$CHART_BUILD_HEADER_DIR \ |
|
225 | 225 | $$CHART_BUILD_LIB_DIR |
|
226 | 226 | win32:QMAKE_DISTCLEAN += /Q \ |
|
227 | 227 | $$CHART_BUILD_HEADER_DIR \ |
|
228 | 228 | $$CHART_BUILD_LIB_DIR |
|
229 | 229 | |
|
230 | 230 | ############################## COVERAGE ######################################### |
|
231 | 231 | |
|
232 | 232 | unix:coverage:{ |
|
233 | 233 | |
|
234 | 234 | QMAKE_CXXFLAGS += -fprofile-arcs -ftest-coverage |
|
235 | 235 | QMAKE_LDFLAGS += -fprofile-arcs -ftest-coverage |
|
236 | 236 | |
|
237 | 237 | LIBS += -lgcov |
|
238 | 238 | |
|
239 | 239 | QMAKE_CLEAN += $$OBJECTS_DIR/*.gcda $$OBJECTS_DIR/*.gcno $$PWD/*.gcov ../coverage/*.info |
|
240 | 240 | QMAKE_EXTRA_TARGETS += preparecoverage gencoverage |
|
241 | 241 | |
|
242 | 242 | preparecoverage.target = prepare_coverage |
|
243 | 243 | preparecoverage.depends = all |
|
244 | 244 | preparecoverage.commands = lcov --directory $$OBJECTS_DIR --zerocounters ;\ |
|
245 | 245 | lcov -i -d $$OBJECTS_DIR -c -o ../coverage/base.info -b $$PWD; |
|
246 | 246 | |
|
247 | 247 | gencoverage.target = gen_coverage |
|
248 | 248 | gencoverage.depends = all |
|
249 | 249 | gencoverage.commands = lcov -d $$OBJECTS_DIR -c -o ../coverage/src.info -b $$PWD;\ |
|
250 | 250 | lcov -e ../coverage/base.info $$PWD/* $$PWD/animations/* $$PWD/areachart/* $$PWD/axis/* $$PWD/barchart/* $$PWD/legend/* $$PWD/linechart/* $$PWD/piechart/* $$PWD/scatterchart/* $$PWD/splinechart/* $$PWD/themes/* $$PWD/xychart/* -o ../coverage/base.info;\ |
|
251 | 251 | lcov -e ../coverage/src.info $$PWD/* $$PWD/animations/* $$PWD/areachart/* $$PWD/axis/* $$PWD/barchart/* $$PWD/legend/* $$PWD/linechart/* $$PWD/piechart/* $$PWD/scatterchart/* $$PWD/splinechart/* $$PWD/themes/* $$PWD/xychart/* -o ../coverage/src.info;\ |
|
252 | 252 | lcov -a ../coverage/base.info -a ../coverage/src.info -o ../coverage/coverage.info; |
|
253 | 253 | } |
|
254 | 254 |
General Comments 0
You need to be logged in to leave comments.
Login now