@@ -1,52 +1,47 | |||||
1 | TARGET = qtcommercialchartqml |
|
1 | TARGET = qtcommercialchartqml | |
2 | QT += declarative |
|
2 | QT += declarative | |
3 |
|
3 | |||
4 | !include( ../plugins.pri ) { |
|
4 | !include( ../plugins.pri ) { | |
5 | error( "Couldn't find the plugins.pri file!" ) |
|
5 | error( "Couldn't find the plugins.pri file!" ) | |
6 | } |
|
6 | } | |
7 | INCLUDEPATH += $$CHART_BUILD_PRIVATE_HEADER_DIR |
|
7 | INCLUDEPATH += $$CHART_BUILD_PRIVATE_HEADER_DIR | |
8 |
|
8 | |||
9 | contains(QT_MAJOR_VERSION, 5) { |
|
|||
10 | # TODO: QtQuick2 not supported by the implementation currently |
|
|||
11 | DEFINES += QTQUICK2 |
|
|||
12 | } |
|
|||
13 |
|
||||
14 | CONFIG(debug, debug|release) { |
|
9 | CONFIG(debug, debug|release) { | |
15 | mac: TARGET = $$join(TARGET,,,_debug) |
|
10 | mac: TARGET = $$join(TARGET,,,_debug) | |
16 | win32: TARGET = $$join(TARGET,,,d) |
|
11 | win32: TARGET = $$join(TARGET,,,d) | |
17 | } |
|
12 | } | |
18 |
|
13 | |||
19 | SOURCES += \ |
|
14 | SOURCES += \ | |
20 | plugin.cpp \ |
|
15 | plugin.cpp \ | |
21 | declarativechart.cpp \ |
|
16 | declarativechart.cpp \ | |
22 | declarativexypoint.cpp \ |
|
17 | declarativexypoint.cpp \ | |
23 | declarativexyseries.cpp \ |
|
18 | declarativexyseries.cpp \ | |
24 | declarativelineseries.cpp \ |
|
19 | declarativelineseries.cpp \ | |
25 | declarativesplineseries.cpp \ |
|
20 | declarativesplineseries.cpp \ | |
26 | declarativeareaseries.cpp \ |
|
21 | declarativeareaseries.cpp \ | |
27 | declarativescatterseries.cpp \ |
|
22 | declarativescatterseries.cpp \ | |
28 | declarativepieseries.cpp \ |
|
23 | declarativepieseries.cpp \ | |
29 | declarativebarseries.cpp \ |
|
24 | declarativebarseries.cpp \ | |
30 | declarativecategoryaxis.cpp |
|
25 | declarativecategoryaxis.cpp | |
31 |
|
26 | |||
32 | HEADERS += \ |
|
27 | HEADERS += \ | |
33 | declarativechart.h \ |
|
28 | declarativechart.h \ | |
34 | declarativexypoint.h \ |
|
29 | declarativexypoint.h \ | |
35 | declarativexyseries.h \ |
|
30 | declarativexyseries.h \ | |
36 | declarativelineseries.h \ |
|
31 | declarativelineseries.h \ | |
37 | declarativesplineseries.h \ |
|
32 | declarativesplineseries.h \ | |
38 | declarativeareaseries.h \ |
|
33 | declarativeareaseries.h \ | |
39 | declarativescatterseries.h \ |
|
34 | declarativescatterseries.h \ | |
40 | declarativepieseries.h \ |
|
35 | declarativepieseries.h \ | |
41 | declarativebarseries.h \ |
|
36 | declarativebarseries.h \ | |
42 | declarativecategoryaxis.h |
|
37 | declarativecategoryaxis.h | |
43 |
|
38 | |||
44 | TARGETPATH = QtCommercial/Chart |
|
39 | TARGETPATH = QtCommercial/Chart | |
45 | target.path = $$[QT_INSTALL_IMPORTS]/$$TARGETPATH |
|
40 | target.path = $$[QT_INSTALL_IMPORTS]/$$TARGETPATH | |
46 | qmldir.files += $$PWD/qmldir |
|
41 | qmldir.files += $$PWD/qmldir | |
47 | qmldir.path += $$[QT_INSTALL_IMPORTS]/$$TARGETPATH |
|
42 | qmldir.path += $$[QT_INSTALL_IMPORTS]/$$TARGETPATH | |
48 | INSTALLS += target qmldir |
|
43 | INSTALLS += target qmldir | |
49 |
|
44 | |||
50 | FILE = $$PWD/qmldir |
|
45 | FILE = $$PWD/qmldir | |
51 | win32:{FILE = $$replace(FILE, "/","\\")} |
|
46 | win32:{FILE = $$replace(FILE, "/","\\")} | |
52 | QMAKE_POST_LINK += $$QMAKE_COPY $$FILE $$CHART_BUILD_PLUGIN_DIR |
|
47 | QMAKE_POST_LINK += $$QMAKE_COPY $$FILE $$CHART_BUILD_PLUGIN_DIR |
@@ -1,157 +1,155 | |||||
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 DECLARATIVECHART_H |
|
21 | #ifndef DECLARATIVECHART_H | |
22 | #define DECLARATIVECHART_H |
|
22 | #define DECLARATIVECHART_H | |
23 |
|
23 | |||
24 | #include <QtCore/QtGlobal> |
|
24 | #include <QtCore/QtGlobal> | |
25 | #include <QDeclarativeItem> |
|
25 | #include <QDeclarativeItem> | |
26 | #include "qchart.h" |
|
26 | #include "qchart.h" | |
27 |
|
27 | |||
28 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
28 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
29 |
|
29 | |||
30 | class DeclarativeChart : public QDeclarativeItem |
|
30 | class DeclarativeChart : public QDeclarativeItem | |
31 | // TODO: for QTQUICK2: extend QQuickPainterItem instead |
|
|||
32 | //class DeclarativeChart : public QQuickPaintedItem, public Chart |
|
|||
33 | { |
|
31 | { | |
34 | Q_OBJECT |
|
32 | Q_OBJECT | |
35 | Q_PROPERTY(Theme theme READ theme WRITE setTheme) |
|
33 | Q_PROPERTY(Theme theme READ theme WRITE setTheme) | |
36 | Q_PROPERTY(Animation animationOptions READ animationOptions WRITE setAnimationOptions) |
|
34 | Q_PROPERTY(Animation animationOptions READ animationOptions WRITE setAnimationOptions) | |
37 | Q_PROPERTY(QString title READ title WRITE setTitle) |
|
35 | Q_PROPERTY(QString title READ title WRITE setTitle) | |
38 | Q_PROPERTY(QFont titleFont READ titleFont WRITE setTitleFont) |
|
36 | Q_PROPERTY(QFont titleFont READ titleFont WRITE setTitleFont) | |
39 | Q_PROPERTY(QColor titleColor READ titleColor WRITE setTitleColor NOTIFY titleColorChanged) |
|
37 | Q_PROPERTY(QColor titleColor READ titleColor WRITE setTitleColor NOTIFY titleColorChanged) | |
40 | Q_PROPERTY(QLegend *legend READ legend) |
|
38 | Q_PROPERTY(QLegend *legend READ legend) | |
41 | Q_PROPERTY(int count READ count) |
|
39 | Q_PROPERTY(int count READ count) | |
42 | Q_PROPERTY(QColor backgroundColor READ backgroundColor WRITE setBackgroundColor NOTIFY backgroundColorChanged) |
|
40 | Q_PROPERTY(QColor backgroundColor READ backgroundColor WRITE setBackgroundColor NOTIFY backgroundColorChanged) | |
43 | Q_PROPERTY(bool dropShadowEnabled READ dropShadowEnabled WRITE setDropShadowEnabled NOTIFY dropShadowEnabledChanged) |
|
41 | Q_PROPERTY(bool dropShadowEnabled READ dropShadowEnabled WRITE setDropShadowEnabled NOTIFY dropShadowEnabledChanged) | |
44 | Q_PROPERTY(qreal topMargin READ topMargin NOTIFY topMarginChanged) |
|
42 | Q_PROPERTY(qreal topMargin READ topMargin NOTIFY topMarginChanged) | |
45 | Q_PROPERTY(qreal bottomMargin READ bottomMargin NOTIFY bottomMarginChanged) |
|
43 | Q_PROPERTY(qreal bottomMargin READ bottomMargin NOTIFY bottomMarginChanged) | |
46 | Q_PROPERTY(qreal leftMargin READ leftMargin NOTIFY leftMarginChanged) |
|
44 | Q_PROPERTY(qreal leftMargin READ leftMargin NOTIFY leftMarginChanged) | |
47 | Q_PROPERTY(qreal rightMargin READ rightMargin NOTIFY rightMarginChanged) |
|
45 | Q_PROPERTY(qreal rightMargin READ rightMargin NOTIFY rightMarginChanged) | |
48 | Q_ENUMS(Animation) |
|
46 | Q_ENUMS(Animation) | |
49 | Q_ENUMS(Theme) |
|
47 | Q_ENUMS(Theme) | |
50 | Q_ENUMS(SeriesType) |
|
48 | Q_ENUMS(SeriesType) | |
51 |
|
49 | |||
52 | public: |
|
50 | public: | |
53 | // duplicating enums from QChart to make the QML api namings 1-to-1 with the C++ api |
|
51 | // duplicating enums from QChart to make the QML api namings 1-to-1 with the C++ api | |
54 | enum Theme { |
|
52 | enum Theme { | |
55 | ChartThemeLight = 0, |
|
53 | ChartThemeLight = 0, | |
56 | ChartThemeBlueCerulean, |
|
54 | ChartThemeBlueCerulean, | |
57 | ChartThemeDark, |
|
55 | ChartThemeDark, | |
58 | ChartThemeBrownSand, |
|
56 | ChartThemeBrownSand, | |
59 | ChartThemeBlueNcs, |
|
57 | ChartThemeBlueNcs, | |
60 | ChartThemeHighContrast, |
|
58 | ChartThemeHighContrast, | |
61 | ChartThemeBlueIcy |
|
59 | ChartThemeBlueIcy | |
62 | }; |
|
60 | }; | |
63 |
|
61 | |||
64 | enum Animation { |
|
62 | enum Animation { | |
65 | NoAnimation = 0x0, |
|
63 | NoAnimation = 0x0, | |
66 | GridAxisAnimations = 0x1, |
|
64 | GridAxisAnimations = 0x1, | |
67 | SeriesAnimations =0x2, |
|
65 | SeriesAnimations =0x2, | |
68 | AllAnimations = 0x3 |
|
66 | AllAnimations = 0x3 | |
69 | }; |
|
67 | }; | |
70 |
|
68 | |||
71 | enum SeriesType { |
|
69 | enum SeriesType { | |
72 | SeriesTypeLine, |
|
70 | SeriesTypeLine, | |
73 | SeriesTypeArea, |
|
71 | SeriesTypeArea, | |
74 | SeriesTypeBar, |
|
72 | SeriesTypeBar, | |
75 | SeriesTypeStackedBar, |
|
73 | SeriesTypeStackedBar, | |
76 | SeriesTypePercentBar, |
|
74 | SeriesTypePercentBar, | |
77 | SeriesTypePie, |
|
75 | SeriesTypePie, | |
78 | SeriesTypeScatter, |
|
76 | SeriesTypeScatter, | |
79 | SeriesTypeSpline, |
|
77 | SeriesTypeSpline, | |
80 | SeriesTypeHorizontalBar, |
|
78 | SeriesTypeHorizontalBar, | |
81 | SeriesTypeHorizontalStackedBar, |
|
79 | SeriesTypeHorizontalStackedBar, | |
82 | SeriesTypeHorizontalPercentBar |
|
80 | SeriesTypeHorizontalPercentBar | |
83 | }; |
|
81 | }; | |
84 |
|
82 | |||
85 | public: |
|
83 | public: | |
86 | DeclarativeChart(QDeclarativeItem *parent = 0); |
|
84 | DeclarativeChart(QDeclarativeItem *parent = 0); | |
87 | ~DeclarativeChart(); |
|
85 | ~DeclarativeChart(); | |
88 |
|
86 | |||
89 | public: // From QDeclarativeItem/QGraphicsItem |
|
87 | public: // From QDeclarativeItem/QGraphicsItem | |
90 | void childEvent(QChildEvent *event); |
|
88 | void childEvent(QChildEvent *event); | |
91 | void componentComplete(); |
|
89 | void componentComplete(); | |
92 | void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry); |
|
90 | void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry); | |
93 |
|
91 | |||
94 | public: |
|
92 | public: | |
95 | void setTheme(DeclarativeChart::Theme theme); |
|
93 | void setTheme(DeclarativeChart::Theme theme); | |
96 | DeclarativeChart::Theme theme(); |
|
94 | DeclarativeChart::Theme theme(); | |
97 | void setAnimationOptions(DeclarativeChart::Animation animations); |
|
95 | void setAnimationOptions(DeclarativeChart::Animation animations); | |
98 | DeclarativeChart::Animation animationOptions(); |
|
96 | DeclarativeChart::Animation animationOptions(); | |
99 | void setTitle(QString title); |
|
97 | void setTitle(QString title); | |
100 | QString title(); |
|
98 | QString title(); | |
101 | QLegend *legend(); |
|
99 | QLegend *legend(); | |
102 | QFont titleFont() const; |
|
100 | QFont titleFont() const; | |
103 | void setTitleFont(const QFont& font); |
|
101 | void setTitleFont(const QFont& font); | |
104 | void setTitleColor(QColor color); |
|
102 | void setTitleColor(QColor color); | |
105 | QColor titleColor(); |
|
103 | QColor titleColor(); | |
106 | void setBackgroundColor(QColor color); |
|
104 | void setBackgroundColor(QColor color); | |
107 | QColor backgroundColor(); |
|
105 | QColor backgroundColor(); | |
108 | int count(); |
|
106 | int count(); | |
109 | void setDropShadowEnabled(bool enabled); |
|
107 | void setDropShadowEnabled(bool enabled); | |
110 | bool dropShadowEnabled(); |
|
108 | bool dropShadowEnabled(); | |
111 | qreal topMargin(); |
|
109 | qreal topMargin(); | |
112 | qreal bottomMargin(); |
|
110 | qreal bottomMargin(); | |
113 | qreal leftMargin(); |
|
111 | qreal leftMargin(); | |
114 | qreal rightMargin(); |
|
112 | qreal rightMargin(); | |
115 | void createDefaultAxes(QAbstractSeries* series); |
|
113 | void createDefaultAxes(QAbstractSeries* series); | |
116 |
|
114 | |||
117 | public: |
|
115 | public: | |
118 | Q_INVOKABLE QAbstractSeries *series(int index); |
|
116 | Q_INVOKABLE QAbstractSeries *series(int index); | |
119 | Q_INVOKABLE QAbstractSeries *series(QString seriesName); |
|
117 | Q_INVOKABLE QAbstractSeries *series(QString seriesName); | |
120 | Q_INVOKABLE QAbstractSeries *createSeries(DeclarativeChart::SeriesType type, QString name = ""); |
|
118 | Q_INVOKABLE QAbstractSeries *createSeries(DeclarativeChart::SeriesType type, QString name = ""); | |
121 | Q_INVOKABLE void setAxisX(QAbstractAxis *axis, QAbstractSeries *series = 0); |
|
119 | Q_INVOKABLE void setAxisX(QAbstractAxis *axis, QAbstractSeries *series = 0); | |
122 | Q_INVOKABLE void setAxisY(QAbstractAxis *axis, QAbstractSeries *series = 0); |
|
120 | Q_INVOKABLE void setAxisY(QAbstractAxis *axis, QAbstractSeries *series = 0); | |
123 | Q_INVOKABLE void createDefaultAxes(); |
|
121 | Q_INVOKABLE void createDefaultAxes(); | |
124 | Q_INVOKABLE QAbstractAxis *axisX(QAbstractSeries *series = 0); |
|
122 | Q_INVOKABLE QAbstractAxis *axisX(QAbstractSeries *series = 0); | |
125 | Q_INVOKABLE QAbstractAxis *axisY(QAbstractSeries *series = 0); |
|
123 | Q_INVOKABLE QAbstractAxis *axisY(QAbstractSeries *series = 0); | |
126 |
|
124 | |||
127 | Q_INVOKABLE void zoom(qreal factor); |
|
125 | Q_INVOKABLE void zoom(qreal factor); | |
128 | Q_INVOKABLE void scrollLeft(qreal pixels); |
|
126 | Q_INVOKABLE void scrollLeft(qreal pixels); | |
129 | Q_INVOKABLE void scrollRight(qreal pixels); |
|
127 | Q_INVOKABLE void scrollRight(qreal pixels); | |
130 | Q_INVOKABLE void scrollUp(qreal pixels); |
|
128 | Q_INVOKABLE void scrollUp(qreal pixels); | |
131 | Q_INVOKABLE void scrollDown(qreal pixels); |
|
129 | Q_INVOKABLE void scrollDown(qreal pixels); | |
132 |
|
130 | |||
133 | Q_SIGNALS: |
|
131 | Q_SIGNALS: | |
134 | void axisLabelsChanged(); |
|
132 | void axisLabelsChanged(); | |
135 | void titleColorChanged(QColor color); |
|
133 | void titleColorChanged(QColor color); | |
136 | void backgroundColorChanged(); |
|
134 | void backgroundColorChanged(); | |
137 | void dropShadowEnabledChanged(bool enabled); |
|
135 | void dropShadowEnabledChanged(bool enabled); | |
138 | void topMarginChanged(qreal margin); |
|
136 | void topMarginChanged(qreal margin); | |
139 | void bottomMarginChanged(qreal margin); |
|
137 | void bottomMarginChanged(qreal margin); | |
140 | void leftMarginChanged(qreal margin); |
|
138 | void leftMarginChanged(qreal margin); | |
141 | void rightMarginChanged(qreal margin); |
|
139 | void rightMarginChanged(qreal margin); | |
142 |
|
140 | |||
143 | public Q_SLOTS: |
|
141 | public Q_SLOTS: | |
144 | void handleMarginsChanged(QRectF newMargins); |
|
142 | void handleMarginsChanged(QRectF newMargins); | |
145 | void handleAxisXSet(QAbstractAxis *axis); |
|
143 | void handleAxisXSet(QAbstractAxis *axis); | |
146 | void handleAxisYSet(QAbstractAxis *axis); |
|
144 | void handleAxisYSet(QAbstractAxis *axis); | |
147 |
|
145 | |||
148 | private: |
|
146 | private: | |
149 | // Extending QChart with DeclarativeChart is not possible because QObject does not support |
|
147 | // Extending QChart with DeclarativeChart is not possible because QObject does not support | |
150 | // multi inheritance, so we now have a QChart as a member instead |
|
148 | // multi inheritance, so we now have a QChart as a member instead | |
151 | QChart *m_chart; |
|
149 | QChart *m_chart; | |
152 | QMargins m_chartMargins; |
|
150 | QMargins m_chartMargins; | |
153 | }; |
|
151 | }; | |
154 |
|
152 | |||
155 | QTCOMMERCIALCHART_END_NAMESPACE |
|
153 | QTCOMMERCIALCHART_END_NAMESPACE | |
156 |
|
154 | |||
157 | #endif // DECLARATIVECHART_H |
|
155 | #endif // DECLARATIVECHART_H |
@@ -1,118 +1,117 | |||||
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 | #include "declarativepieseries.h" |
|
21 | #include "declarativepieseries.h" | |
22 | #include "qpieslice.h" |
|
22 | #include "qpieslice.h" | |
23 | #include "qvpiemodelmapper.h" |
|
23 | #include "qvpiemodelmapper.h" | |
24 | #include "qhpiemodelmapper.h" |
|
24 | #include "qhpiemodelmapper.h" | |
25 |
|
25 | |||
26 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
26 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
27 |
|
27 | |||
28 | DeclarativePieSeries::DeclarativePieSeries(QDeclarativeItem *parent) : |
|
28 | DeclarativePieSeries::DeclarativePieSeries(QDeclarativeItem *parent) : | |
29 | QPieSeries(parent) |
|
29 | QPieSeries(parent) | |
30 | { |
|
30 | { | |
31 | connect(this, SIGNAL(added(QList<QPieSlice*>)), this, SLOT(handleAdded(QList<QPieSlice*>))); |
|
31 | connect(this, SIGNAL(added(QList<QPieSlice*>)), this, SLOT(handleAdded(QList<QPieSlice*>))); | |
32 | connect(this, SIGNAL(removed(QList<QPieSlice*>)), this, SLOT(handleRemoved(QList<QPieSlice*>))); |
|
32 | connect(this, SIGNAL(removed(QList<QPieSlice*>)), this, SLOT(handleRemoved(QList<QPieSlice*>))); | |
33 | } |
|
33 | } | |
34 |
|
34 | |||
35 | void DeclarativePieSeries::classBegin() |
|
35 | void DeclarativePieSeries::classBegin() | |
36 | { |
|
36 | { | |
37 | } |
|
37 | } | |
38 |
|
38 | |||
39 | void DeclarativePieSeries::componentComplete() |
|
39 | void DeclarativePieSeries::componentComplete() | |
40 | { |
|
40 | { | |
41 | foreach(QObject *child, children()) { |
|
41 | foreach(QObject *child, children()) { | |
42 | if (qobject_cast<QPieSlice *>(child)) { |
|
42 | if (qobject_cast<QPieSlice *>(child)) { | |
43 | QPieSeries::append(qobject_cast<QPieSlice *>(child)); |
|
43 | QPieSeries::append(qobject_cast<QPieSlice *>(child)); | |
44 | } else if(qobject_cast<QVPieModelMapper *>(child)) { |
|
44 | } else if(qobject_cast<QVPieModelMapper *>(child)) { | |
45 | QVPieModelMapper *mapper = qobject_cast<QVPieModelMapper *>(child); |
|
45 | QVPieModelMapper *mapper = qobject_cast<QVPieModelMapper *>(child); | |
46 | mapper->setSeries(this); |
|
46 | mapper->setSeries(this); | |
47 | } else if(qobject_cast<QHPieModelMapper *>(child)) { |
|
47 | } else if(qobject_cast<QHPieModelMapper *>(child)) { | |
48 | QHPieModelMapper *mapper = qobject_cast<QHPieModelMapper *>(child); |
|
48 | QHPieModelMapper *mapper = qobject_cast<QHPieModelMapper *>(child); | |
49 | mapper->setSeries(this); |
|
49 | mapper->setSeries(this); | |
50 | } |
|
50 | } | |
51 | } |
|
51 | } | |
52 | } |
|
52 | } | |
53 |
|
53 | |||
54 | QDeclarativeListProperty<QObject> DeclarativePieSeries::seriesChildren() |
|
54 | QDeclarativeListProperty<QObject> DeclarativePieSeries::seriesChildren() | |
55 | { |
|
55 | { | |
56 | return QDeclarativeListProperty<QObject>(this, 0, &DeclarativePieSeries::appendSeriesChildren); |
|
56 | return QDeclarativeListProperty<QObject>(this, 0, &DeclarativePieSeries::appendSeriesChildren); | |
57 | } |
|
57 | } | |
58 |
|
58 | |||
59 | void DeclarativePieSeries::appendSeriesChildren(QDeclarativeListProperty<QObject> * list, QObject *element) |
|
59 | void DeclarativePieSeries::appendSeriesChildren(QDeclarativeListProperty<QObject> * list, QObject *element) | |
60 | { |
|
60 | { | |
61 | // Empty implementation; the children are parsed in componentComplete instead |
|
61 | // Empty implementation; the children are parsed in componentComplete instead | |
62 | Q_UNUSED(list); |
|
62 | Q_UNUSED(list); | |
63 | Q_UNUSED(element); |
|
63 | Q_UNUSED(element); | |
64 | } |
|
64 | } | |
65 |
|
65 | |||
66 | QPieSlice *DeclarativePieSeries::at(int index) |
|
66 | QPieSlice *DeclarativePieSeries::at(int index) | |
67 | { |
|
67 | { | |
68 | QList<QPieSlice*> sliceList = slices(); |
|
68 | QList<QPieSlice*> sliceList = slices(); | |
69 | if (index >= 0 && index < sliceList.count()) |
|
69 | if (index >= 0 && index < sliceList.count()) | |
70 | return sliceList[index]; |
|
70 | return sliceList[index]; | |
71 |
|
71 | |||
72 | return 0; |
|
72 | return 0; | |
73 | } |
|
73 | } | |
74 |
|
74 | |||
75 | QPieSlice* DeclarativePieSeries::find(QString label) |
|
75 | QPieSlice* DeclarativePieSeries::find(QString label) | |
76 | { |
|
76 | { | |
77 | foreach (QPieSlice *slice, slices()) { |
|
77 | foreach (QPieSlice *slice, slices()) { | |
78 | if (slice->label() == label) |
|
78 | if (slice->label() == label) | |
79 | return slice; |
|
79 | return slice; | |
80 | } |
|
80 | } | |
81 | return 0; |
|
81 | return 0; | |
82 | } |
|
82 | } | |
83 |
|
83 | |||
84 | QPieSlice* DeclarativePieSeries::append(QString label, qreal value) |
|
84 | QPieSlice* DeclarativePieSeries::append(QString label, qreal value) | |
85 | { |
|
85 | { | |
86 | // TODO: parameter order is wrong, switch it: |
|
|||
87 | QPieSlice *slice = new QPieSlice(this); |
|
86 | QPieSlice *slice = new QPieSlice(this); | |
88 | slice->setLabel(label); |
|
87 | slice->setLabel(label); | |
89 | slice->setValue(value); |
|
88 | slice->setValue(value); | |
90 | QPieSeries::append(slice); |
|
89 | QPieSeries::append(slice); | |
91 | return slice; |
|
90 | return slice; | |
92 | } |
|
91 | } | |
93 |
|
92 | |||
94 | bool DeclarativePieSeries::remove(QPieSlice *slice) |
|
93 | bool DeclarativePieSeries::remove(QPieSlice *slice) | |
95 | { |
|
94 | { | |
96 | return QPieSeries::remove(slice); |
|
95 | return QPieSeries::remove(slice); | |
97 | } |
|
96 | } | |
98 |
|
97 | |||
99 | void DeclarativePieSeries::clear() |
|
98 | void DeclarativePieSeries::clear() | |
100 | { |
|
99 | { | |
101 | QPieSeries::clear(); |
|
100 | QPieSeries::clear(); | |
102 | } |
|
101 | } | |
103 |
|
102 | |||
104 | void DeclarativePieSeries::handleAdded(QList<QPieSlice*> slices) |
|
103 | void DeclarativePieSeries::handleAdded(QList<QPieSlice*> slices) | |
105 | { |
|
104 | { | |
106 | foreach(QPieSlice *slice, slices) |
|
105 | foreach(QPieSlice *slice, slices) | |
107 | emit sliceAdded(slice); |
|
106 | emit sliceAdded(slice); | |
108 | } |
|
107 | } | |
109 |
|
108 | |||
110 | void DeclarativePieSeries::handleRemoved(QList<QPieSlice*> slices) |
|
109 | void DeclarativePieSeries::handleRemoved(QList<QPieSlice*> slices) | |
111 | { |
|
110 | { | |
112 | foreach(QPieSlice *slice, slices) |
|
111 | foreach(QPieSlice *slice, slices) | |
113 | emit sliceRemoved(slice); |
|
112 | emit sliceRemoved(slice); | |
114 | } |
|
113 | } | |
115 |
|
114 | |||
116 | #include "moc_declarativepieseries.cpp" |
|
115 | #include "moc_declarativepieseries.cpp" | |
117 |
|
116 | |||
118 | QTCOMMERCIALCHART_END_NAMESPACE |
|
117 | QTCOMMERCIALCHART_END_NAMESPACE |
@@ -1,43 +1,42 | |||||
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 DECLARATIVE_XY_POINT_H |
|
21 | #ifndef DECLARATIVE_XY_POINT_H | |
22 | #define DECLARATIVE_XY_POINT_H |
|
22 | #define DECLARATIVE_XY_POINT_H | |
23 |
|
23 | |||
24 | #include "qchartglobal.h" |
|
24 | #include "qchartglobal.h" | |
25 | #include <QObject> |
|
25 | #include <QObject> | |
26 | #include <QPointF> |
|
26 | #include <QPointF> | |
27 |
|
27 | |||
28 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
28 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
29 |
|
29 | |||
30 | class DeclarativeXYPoint : public QObject, public QPointF |
|
30 | class DeclarativeXYPoint : public QObject, public QPointF | |
31 | { |
|
31 | { | |
32 | Q_OBJECT |
|
32 | Q_OBJECT | |
33 | // TODO: make the setters change the value, if parented by a series |
|
33 | Q_PROPERTY(qreal x READ x WRITE setX) | |
34 |
Q_PROPERTY(qreal |
|
34 | Q_PROPERTY(qreal y READ y WRITE setY) | |
35 | Q_PROPERTY(qreal y READ y WRITE setY /*NOTIFY dataYChanged*/) |
|
|||
36 |
|
35 | |||
37 | public: |
|
36 | public: | |
38 | explicit DeclarativeXYPoint(QObject *parent = 0); |
|
37 | explicit DeclarativeXYPoint(QObject *parent = 0); | |
39 | }; |
|
38 | }; | |
40 |
|
39 | |||
41 | QTCOMMERCIALCHART_END_NAMESPACE |
|
40 | QTCOMMERCIALCHART_END_NAMESPACE | |
42 |
|
41 | |||
43 | #endif // DECLARATIVE_XY_POINT_H |
|
42 | #endif // DECLARATIVE_XY_POINT_H |
@@ -1,180 +1,177 | |||||
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 | // W A R N I N G |
|
21 | // W A R N I N G | |
22 | // ------------- |
|
22 | // ------------- | |
23 | // |
|
23 | // | |
24 | // This file is not part of the QtCommercial Chart API. It exists purely as an |
|
24 | // This file is not part of the QtCommercial Chart API. It exists purely as an | |
25 | // implementation detail. This header file may change from version to |
|
25 | // implementation detail. This header file may change from version to | |
26 | // version without notice, or even be removed. |
|
26 | // version without notice, or even be removed. | |
27 | // |
|
27 | // | |
28 | // We mean it. |
|
28 | // We mean it. | |
29 |
|
29 | |||
30 | #ifndef CHARTTHEMESYSTEM_P_H |
|
30 | #ifndef CHARTTHEMESYSTEM_P_H | |
31 | #define CHARTTHEMESYSTEM_P_H |
|
31 | #define CHARTTHEMESYSTEM_P_H | |
32 |
|
32 | |||
33 | #include "charttheme_p.h" |
|
33 | #include "charttheme_p.h" | |
34 | #ifdef Q_OS_WIN |
|
34 | #ifdef Q_OS_WIN | |
35 | #include <windows.h> |
|
35 | #include <windows.h> | |
36 | #include <stdio.h> |
|
36 | #include <stdio.h> | |
37 | #endif |
|
37 | #endif | |
38 |
|
38 | |||
39 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
39 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
40 |
|
40 | |||
41 | class ChartThemeSystem: public ChartTheme |
|
41 | class ChartThemeSystem: public ChartTheme | |
42 | { |
|
42 | { | |
43 | public: |
|
43 | public: | |
44 | // System theme not used at the moment (the user is not able to select this theme) |
|
44 | // System theme not used at the moment (the user is not able to select this theme) | |
45 | ChartThemeSystem() : ChartTheme(QChart::ChartThemeLight /*QChart::ChartThemeSystem*/) |
|
45 | ChartThemeSystem() : ChartTheme(QChart::ChartThemeLight /*QChart::ChartThemeSystem*/) | |
46 | { |
|
46 | { | |
47 | #ifdef Q_OS_WIN |
|
47 | #ifdef Q_OS_WIN | |
48 |
// |
|
48 | // We could also use theme specific window frame color as a series base color (it would give more | |
49 | // variation to the base colors in addition to the blue and black used now) |
|
49 | // variation to the base colors in addition to the blue and black used now) | |
50 | // TODO: COLOR_WINDOWTEXT for text color? |
|
|||
51 | // TODO: COLOR_INFOTEXT for tooltip text color? |
|
|||
52 | // TODO: COLOR_INFOBK for tooltip background color? |
|
|||
53 |
|
50 | |||
54 | // First series base color from COLOR_HIGHLIGHT |
|
51 | // First series base color from COLOR_HIGHLIGHT | |
55 | DWORD colorHighlight; |
|
52 | DWORD colorHighlight; | |
56 | colorHighlight = GetSysColor(COLOR_HIGHLIGHT); |
|
53 | colorHighlight = GetSysColor(COLOR_HIGHLIGHT); | |
57 | m_seriesColors.append(QColor(GetRValue(colorHighlight), |
|
54 | m_seriesColors.append(QColor(GetRValue(colorHighlight), | |
58 | GetGValue(colorHighlight), |
|
55 | GetGValue(colorHighlight), | |
59 | GetBValue(colorHighlight))); |
|
56 | GetBValue(colorHighlight))); | |
60 |
|
57 | |||
61 | // Second series base color from COLOR_WINDOWFRAME |
|
58 | // Second series base color from COLOR_WINDOWFRAME | |
62 | DWORD colorWindowFrame; |
|
59 | DWORD colorWindowFrame; | |
63 | colorWindowFrame = GetSysColor(COLOR_WINDOWFRAME); |
|
60 | colorWindowFrame = GetSysColor(COLOR_WINDOWFRAME); | |
64 | m_seriesColors.append(QColor(GetRValue(colorWindowFrame), |
|
61 | m_seriesColors.append(QColor(GetRValue(colorWindowFrame), | |
65 | GetGValue(colorWindowFrame), |
|
62 | GetGValue(colorWindowFrame), | |
66 | GetBValue(colorWindowFrame))); |
|
63 | GetBValue(colorWindowFrame))); | |
67 |
|
64 | |||
68 | // Third series base color from the middle of the COLOR_ACTIVECAPTION / |
|
65 | // Third series base color from the middle of the COLOR_ACTIVECAPTION / | |
69 | // COLOR_GRADIENTACTIVECAPTION gradient |
|
66 | // COLOR_GRADIENTACTIVECAPTION gradient | |
70 | DWORD colorGradientActiveCaptionLeft; |
|
67 | DWORD colorGradientActiveCaptionLeft; | |
71 | colorGradientActiveCaptionLeft = GetSysColor(COLOR_ACTIVECAPTION); |
|
68 | colorGradientActiveCaptionLeft = GetSysColor(COLOR_ACTIVECAPTION); | |
72 | DWORD colorGradientActiveCaptionRight; |
|
69 | DWORD colorGradientActiveCaptionRight; | |
73 | colorGradientActiveCaptionRight = GetSysColor(COLOR_GRADIENTACTIVECAPTION); |
|
70 | colorGradientActiveCaptionRight = GetSysColor(COLOR_GRADIENTACTIVECAPTION); | |
74 | QLinearGradient g; |
|
71 | QLinearGradient g; | |
75 | QColor start = QColor(GetRValue(colorGradientActiveCaptionLeft), |
|
72 | QColor start = QColor(GetRValue(colorGradientActiveCaptionLeft), | |
76 | GetGValue(colorGradientActiveCaptionLeft), |
|
73 | GetGValue(colorGradientActiveCaptionLeft), | |
77 | GetBValue(colorGradientActiveCaptionLeft)); |
|
74 | GetBValue(colorGradientActiveCaptionLeft)); | |
78 | g.setColorAt(0.0, start); |
|
75 | g.setColorAt(0.0, start); | |
79 | QColor end = QColor(GetRValue(colorGradientActiveCaptionRight), |
|
76 | QColor end = QColor(GetRValue(colorGradientActiveCaptionRight), | |
80 | GetGValue(colorGradientActiveCaptionRight), |
|
77 | GetGValue(colorGradientActiveCaptionRight), | |
81 | GetBValue(colorGradientActiveCaptionRight)); |
|
78 | GetBValue(colorGradientActiveCaptionRight)); | |
82 | g.setColorAt(1.0, end); |
|
79 | g.setColorAt(1.0, end); | |
83 | m_seriesColors.append(colorAt(g, 0.5)); |
|
80 | m_seriesColors.append(colorAt(g, 0.5)); | |
84 |
|
81 | |||
85 | // Generate gradients from the base colors |
|
82 | // Generate gradients from the base colors | |
86 | generateSeriesGradients(); |
|
83 | generateSeriesGradients(); | |
87 |
|
84 | |||
88 | // Background fill color from COLOR_WINDOW |
|
85 | // Background fill color from COLOR_WINDOW | |
89 | QLinearGradient backgroundGradient; |
|
86 | QLinearGradient backgroundGradient; | |
90 | DWORD colorWindow; |
|
87 | DWORD colorWindow; | |
91 | colorWindow = GetSysColor(COLOR_WINDOW); |
|
88 | colorWindow = GetSysColor(COLOR_WINDOW); | |
92 | backgroundGradient.setColorAt(0.0, QColor(GetRValue(colorWindow), |
|
89 | backgroundGradient.setColorAt(0.0, QColor(GetRValue(colorWindow), | |
93 | GetGValue(colorWindow), |
|
90 | GetGValue(colorWindow), | |
94 | GetBValue(colorWindow))); |
|
91 | GetBValue(colorWindow))); | |
95 | backgroundGradient.setColorAt(1.0, QColor(GetRValue(colorWindow), |
|
92 | backgroundGradient.setColorAt(1.0, QColor(GetRValue(colorWindow), | |
96 | GetGValue(colorWindow), |
|
93 | GetGValue(colorWindow), | |
97 | GetBValue(colorWindow))); |
|
94 | GetBValue(colorWindow))); | |
98 | // Axes and other |
|
95 | // Axes and other | |
99 | m_axisLinePen = QPen(0xd6d6d6); |
|
96 | m_axisLinePen = QPen(0xd6d6d6); | |
100 | m_axisLinePen.setWidth(1); |
|
97 | m_axisLinePen.setWidth(1); | |
101 | m_labelBrush = QBrush(QRgb(0x404044)); |
|
98 | m_labelBrush = QBrush(QRgb(0x404044)); | |
102 | m_gridLinePen = QPen(QRgb(0xe2e2e2)); |
|
99 | m_gridLinePen = QPen(QRgb(0xe2e2e2)); | |
103 | m_gridLinePen.setWidth(1); |
|
100 | m_gridLinePen.setWidth(1); | |
104 | m_backgroundShades = BackgroundShadesNone; |
|
101 | m_backgroundShades = BackgroundShadesNone; | |
105 |
|
102 | |||
106 | #elif defined(Q_OS_LINUX) |
|
103 | #elif defined(Q_OS_LINUX) | |
107 | // TODO: replace this dummy theme with linux specific theme |
|
104 | // Using a hard coded theme for Linux system theme | |
108 | m_seriesColors << QRgb(0x60a6e6); |
|
105 | m_seriesColors << QRgb(0x60a6e6); | |
109 | m_seriesColors << QRgb(0x92ca66); |
|
106 | m_seriesColors << QRgb(0x92ca66); | |
110 | m_seriesColors << QRgb(0xeba85f); |
|
107 | m_seriesColors << QRgb(0xeba85f); | |
111 | m_seriesColors << QRgb(0xfc5751); |
|
108 | m_seriesColors << QRgb(0xfc5751); | |
112 | generateSeriesGradients(); |
|
109 | generateSeriesGradients(); | |
113 |
|
110 | |||
114 | // Background |
|
111 | // Background | |
115 | QLinearGradient backgroundGradient; |
|
112 | QLinearGradient backgroundGradient; | |
116 | backgroundGradient.setColorAt(0.0, QRgb(0xffffff)); |
|
113 | backgroundGradient.setColorAt(0.0, QRgb(0xffffff)); | |
117 | backgroundGradient.setColorAt(1.0, QRgb(0xffffff)); |
|
114 | backgroundGradient.setColorAt(1.0, QRgb(0xffffff)); | |
118 | backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode); |
|
115 | backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode); | |
119 | m_chartBackgroundGradient = backgroundGradient; |
|
116 | m_chartBackgroundGradient = backgroundGradient; | |
120 |
|
117 | |||
121 | // Axes and other |
|
118 | // Axes and other | |
122 | m_axisLinePen = QPen(0xd6d6d6); |
|
119 | m_axisLinePen = QPen(0xd6d6d6); | |
123 | m_axisLinePen.setWidth(1); |
|
120 | m_axisLinePen.setWidth(1); | |
124 | m_labelBrush = QBrush(QRgb(0x404044)); |
|
121 | m_labelBrush = QBrush(QRgb(0x404044)); | |
125 | m_gridLinePen = QPen(QRgb(0xe2e2e2)); |
|
122 | m_gridLinePen = QPen(QRgb(0xe2e2e2)); | |
126 | m_gridLinePen.setWidth(1); |
|
123 | m_gridLinePen.setWidth(1); | |
127 | m_backgroundShades = BackgroundShadesNone; |
|
124 | m_backgroundShades = BackgroundShadesNone; | |
128 |
|
125 | |||
129 | #elif defined(Q_OS_MAC) |
|
126 | #elif defined(Q_OS_MAC) | |
130 | // TODO: replace this dummy theme with OSX specific theme |
|
127 | // Using a hard coded theme for OSX system theme; the colors match the OSX 10.7 colors | |
131 | m_seriesColors << QRgb(0x60a6e6); |
|
128 | m_seriesColors << QRgb(0x60a6e6); | |
132 | m_seriesColors << QRgb(0x92ca66); |
|
129 | m_seriesColors << QRgb(0x92ca66); | |
133 | m_seriesColors << QRgb(0xeba85f); |
|
130 | m_seriesColors << QRgb(0xeba85f); | |
134 | m_seriesColors << QRgb(0xfc5751); |
|
131 | m_seriesColors << QRgb(0xfc5751); | |
135 | generateSeriesGradients(); |
|
132 | generateSeriesGradients(); | |
136 |
|
133 | |||
137 | // Background |
|
134 | // Background | |
138 | QLinearGradient backgroundGradient; |
|
135 | QLinearGradient backgroundGradient; | |
139 | backgroundGradient.setColorAt(0.0, QRgb(0xffffff)); |
|
136 | backgroundGradient.setColorAt(0.0, QRgb(0xffffff)); | |
140 | backgroundGradient.setColorAt(1.0, QRgb(0xffffff)); |
|
137 | backgroundGradient.setColorAt(1.0, QRgb(0xffffff)); | |
141 | backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode); |
|
138 | backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode); | |
142 | m_chartBackgroundGradient = backgroundGradient; |
|
139 | m_chartBackgroundGradient = backgroundGradient; | |
143 |
|
140 | |||
144 | // Axes and other |
|
141 | // Axes and other | |
145 | m_axisLinePen = QPen(0xd6d6d6); |
|
142 | m_axisLinePen = QPen(0xd6d6d6); | |
146 | m_axisLinePen.setWidth(1); |
|
143 | m_axisLinePen.setWidth(1); | |
147 | m_labelBrush = QBrush(QRgb(0x404044)); |
|
144 | m_labelBrush = QBrush(QRgb(0x404044)); | |
148 | m_gridLinePen = QPen(QRgb(0xe2e2e2)); |
|
145 | m_gridLinePen = QPen(QRgb(0xe2e2e2)); | |
149 | m_gridLinePen.setWidth(1); |
|
146 | m_gridLinePen.setWidth(1); | |
150 | m_backgroundShades = BackgroundShadesNone; |
|
147 | m_backgroundShades = BackgroundShadesNone; | |
151 |
|
148 | |||
152 | #else |
|
149 | #else | |
153 | // TODO: replace this dummy theme with generic (not OS specific) theme |
|
150 | // Hard coded theme | |
154 | m_seriesColors << QRgb(0x60a6e6); |
|
151 | m_seriesColors << QRgb(0x60a6e6); | |
155 | m_seriesColors << QRgb(0x92ca66); |
|
152 | m_seriesColors << QRgb(0x92ca66); | |
156 | m_seriesColors << QRgb(0xeba85f); |
|
153 | m_seriesColors << QRgb(0xeba85f); | |
157 | m_seriesColors << QRgb(0xfc5751); |
|
154 | m_seriesColors << QRgb(0xfc5751); | |
158 | generateSeriesGradients(); |
|
155 | generateSeriesGradients(); | |
159 |
|
156 | |||
160 | // Background |
|
157 | // Background | |
161 | QLinearGradient backgroundGradient; |
|
158 | QLinearGradient backgroundGradient; | |
162 | backgroundGradient.setColorAt(0.0, QRgb(0xffffff)); |
|
159 | backgroundGradient.setColorAt(0.0, QRgb(0xffffff)); | |
163 | backgroundGradient.setColorAt(1.0, QRgb(0xffffff)); |
|
160 | backgroundGradient.setColorAt(1.0, QRgb(0xffffff)); | |
164 | backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode); |
|
161 | backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode); | |
165 | m_chartBackgroundGradient = backgroundGradient; |
|
162 | m_chartBackgroundGradient = backgroundGradient; | |
166 |
|
163 | |||
167 | // Axes and other |
|
164 | // Axes and other | |
168 | m_axisLinePen = QPen(0xd6d6d6); |
|
165 | m_axisLinePen = QPen(0xd6d6d6); | |
169 | m_axisLinePen.setWidth(1); |
|
166 | m_axisLinePen.setWidth(1); | |
170 | m_labelBrush = QBrush(QRgb(0x404044)); |
|
167 | m_labelBrush = QBrush(QRgb(0x404044)); | |
171 | m_gridLinePen = QPen(QRgb(0xe2e2e2)); |
|
168 | m_gridLinePen = QPen(QRgb(0xe2e2e2)); | |
172 | m_gridLinePen.setWidth(1); |
|
169 | m_gridLinePen.setWidth(1); | |
173 | m_backgroundShades = BackgroundShadesNone; |
|
170 | m_backgroundShades = BackgroundShadesNone; | |
174 | #endif |
|
171 | #endif | |
175 | } |
|
172 | } | |
176 | }; |
|
173 | }; | |
177 |
|
174 | |||
178 | QTCOMMERCIALCHART_END_NAMESPACE |
|
175 | QTCOMMERCIALCHART_END_NAMESPACE | |
179 |
|
176 | |||
180 | #endif // CHARTTHEMESYSTEM_P_H |
|
177 | #endif // CHARTTHEMESYSTEM_P_H |
General Comments 0
You need to be logged in to leave comments.
Login now