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