@@ -174,6 +174,16 public Q_SLOTS: | |||||
174 | QChart::ChartTheme theme = (QChart::ChartTheme) m_themeComboBox->itemData(m_themeComboBox->currentIndex()).toInt(); |
|
174 | QChart::ChartTheme theme = (QChart::ChartTheme) m_themeComboBox->itemData(m_themeComboBox->currentIndex()).toInt(); | |
175 | foreach (QChartView *chart, m_charts) |
|
175 | foreach (QChartView *chart, m_charts) | |
176 | chart->setChartTheme(theme); |
|
176 | chart->setChartTheme(theme); | |
|
177 | ||||
|
178 | QPalette pal = window()->palette(); | |||
|
179 | if (theme == QChart::ChartThemeBlueCerulean) { | |||
|
180 | pal.setColor(QPalette::Window, QRgb(0x121218)); | |||
|
181 | pal.setColor(QPalette::WindowText, QRgb(0xd6d6d6)); | |||
|
182 | } else { | |||
|
183 | pal.setColor(QPalette::Window, QRgb(0xf0f0f0)); | |||
|
184 | pal.setColor(QPalette::WindowText, QRgb(0x404044)); | |||
|
185 | } | |||
|
186 | window()->setPalette(pal); | |||
177 | } |
|
187 | } | |
178 |
|
188 | |||
179 | private: |
|
189 | private: |
@@ -40,7 +40,15 | |||||
40 |
|
40 | |||
41 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
41 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
42 |
|
42 | |||
43 | ChartTheme::ChartTheme(QChart::ChartTheme id) |
|
43 | ChartTheme::ChartTheme(QChart::ChartTheme id) : | |
|
44 | m_masterFont(QFont()), | |||
|
45 | m_titleBrush(QColor(QRgb(0x000000))), | |||
|
46 | m_axisLinePen(QPen(QRgb(0x000000))), | |||
|
47 | m_axisLabelBrush(QColor(QRgb(0x000000))), | |||
|
48 | m_backgroundShadesPen(Qt::NoPen), | |||
|
49 | m_backgroundShadesBrush(Qt::NoBrush), | |||
|
50 | m_backgroundShades(BackgroundShadesNone), | |||
|
51 | m_gridLinePen(QPen(QRgb(0x000000))) | |||
44 | { |
|
52 | { | |
45 | m_id = id; |
|
53 | m_id = id; | |
46 | qsrand(QTime(0,0,0).secsTo(QTime::currentTime())); |
|
54 | qsrand(QTime(0,0,0).secsTo(QTime::currentTime())); | |
@@ -75,6 +83,7 void ChartTheme::decorate(QChart* chart) | |||||
75 | chart->setChartBackgroundBrush(Qt::NoBrush); |
|
83 | chart->setChartBackgroundBrush(Qt::NoBrush); | |
76 | } |
|
84 | } | |
77 | chart->setChartTitleFont(m_masterFont); |
|
85 | chart->setChartTitleFont(m_masterFont); | |
|
86 | chart->setChartTitleBrush(m_titleBrush); | |||
78 | } |
|
87 | } | |
79 |
|
88 | |||
80 | void ChartTheme::decorate(QLegend* legend) |
|
89 | void ChartTheme::decorate(QLegend* legend) | |
@@ -214,7 +223,7 void ChartTheme::decorate(QChartAxis* axis,bool axisX) | |||||
214 | { |
|
223 | { | |
215 | if (axis->isAxisVisible()) { |
|
224 | if (axis->isAxisVisible()) { | |
216 | axis->setLabelsBrush(m_axisLabelBrush); |
|
225 | axis->setLabelsBrush(m_axisLabelBrush); | |
217 | axis->setLabelsPen(m_axisLabelPen); |
|
226 | axis->setLabelsPen(Qt::NoPen); // NoPen for performance reasons | |
218 | if (m_backgroundShades == BackgroundShadesBoth |
|
227 | if (m_backgroundShades == BackgroundShadesBoth | |
219 | || (m_backgroundShades == BackgroundShadesVertical && axisX) |
|
228 | || (m_backgroundShades == BackgroundShadesVertical && axisX) | |
220 | || (m_backgroundShades == BackgroundShadesHorizontal && !axisX)) { |
|
229 | || (m_backgroundShades == BackgroundShadesHorizontal && !axisX)) { |
@@ -67,9 +67,9 protected: | |||||
67 | QLinearGradient m_chartBackgroundGradient; |
|
67 | QLinearGradient m_chartBackgroundGradient; | |
68 |
|
68 | |||
69 | QFont m_masterFont; |
|
69 | QFont m_masterFont; | |
|
70 | QBrush m_titleBrush; | |||
70 | QPen m_axisLinePen; |
|
71 | QPen m_axisLinePen; | |
71 | QBrush m_axisLabelBrush; |
|
72 | QBrush m_axisLabelBrush; | |
72 | QPen m_axisLabelPen; |
|
|||
73 | QPen m_backgroundShadesPen; |
|
73 | QPen m_backgroundShadesPen; | |
74 | QBrush m_backgroundShadesBrush; |
|
74 | QBrush m_backgroundShadesBrush; | |
75 | BackgroundShadesMode m_backgroundShades; |
|
75 | BackgroundShadesMode m_backgroundShades; |
@@ -17,19 +17,17 public: | |||||
17 |
|
17 | |||
18 | // Background |
|
18 | // Background | |
19 | QLinearGradient backgroundGradient; |
|
19 | QLinearGradient backgroundGradient; | |
20 |
backgroundGradient.setColorAt(0.0, QRgb(0x |
|
20 | backgroundGradient.setColorAt(0.0, QRgb(0x2e303a)); | |
21 | backgroundGradient.setColorAt(1.0, QRgb(0x121218)); |
|
21 | backgroundGradient.setColorAt(1.0, QRgb(0x121218)); | |
22 | backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode); |
|
22 | backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode); | |
23 | m_chartBackgroundGradient = backgroundGradient; |
|
23 | m_chartBackgroundGradient = backgroundGradient; | |
24 |
|
24 | |||
25 | // Axes and other |
|
25 | // Axes and other | |
26 | m_masterFont = QFont(); |
|
26 | m_masterFont = QFont("arial"); | |
|
27 | m_titleBrush = QBrush(QRgb(0xffffff)); | |||
27 | m_axisLinePen = QPen(QRgb(0x86878c)); |
|
28 | m_axisLinePen = QPen(QRgb(0x86878c)); | |
28 | m_axisLinePen.setWidth(2); |
|
29 | m_axisLinePen.setWidth(2); | |
29 |
m_axisLabelBrush = QBrush(QRgb(0x |
|
30 | m_axisLabelBrush = QBrush(QRgb(0xffffff)); | |
30 | m_axisLabelPen = Qt::NoPen; // NoPen for performance reasons |
|
|||
31 | m_backgroundShadesPen = Qt::NoPen; |
|
|||
32 | m_backgroundShades = BackgroundShadesNone; |
|
|||
33 | m_gridLinePen = QPen(QRgb(0x86878c)); |
|
31 | m_gridLinePen = QPen(QRgb(0x86878c)); | |
34 | m_gridLinePen.setWidth(1); |
|
32 | m_gridLinePen.setWidth(1); | |
35 | } |
|
33 | } |
@@ -63,13 +63,6 public: | |||||
63 | GetGValue(colorWindow), |
|
63 | GetGValue(colorWindow), | |
64 | GetBValue(colorWindow))); |
|
64 | GetBValue(colorWindow))); | |
65 | // Axes and other |
|
65 | // Axes and other | |
66 | m_masterFont = QFont(); |
|
|||
67 | m_masterFont.setPointSizeF(10.0); |
|
|||
68 | m_axisLinePen = QPen(Qt::black); |
|
|||
69 | m_axisLinePen.setWidth(2); |
|
|||
70 | m_axisLabelBrush = QBrush(Qt::black); |
|
|||
71 | m_axisLabelPen = Qt::NoPen; // NoPen for performance reasons |
|
|||
72 | m_backgroundShadesPen = Qt::NoPen; |
|
|||
73 | m_backgroundShadesBrush = QBrush(QColor(0xaf, 0xaf, 0xaf, 0x50)); |
|
66 | m_backgroundShadesBrush = QBrush(QColor(0xaf, 0xaf, 0xaf, 0x50)); | |
74 | m_backgroundShades = BackgroundShadesVertical; |
|
67 | m_backgroundShades = BackgroundShadesVertical; | |
75 |
|
68 | |||
@@ -88,13 +81,6 public: | |||||
88 | m_chartBackgroundGradient = backgroundGradient; |
|
81 | m_chartBackgroundGradient = backgroundGradient; | |
89 |
|
82 | |||
90 | // Axes and other |
|
83 | // Axes and other | |
91 | m_masterFont = QFont(); |
|
|||
92 | m_masterFont.setPointSizeF(10.0); |
|
|||
93 | m_axisLinePen = QPen(Qt::black); |
|
|||
94 | m_axisLinePen.setWidth(2); |
|
|||
95 | m_axisLabelBrush = QBrush(Qt::black); |
|
|||
96 | m_axisLabelPen = Qt::NoPen; // NoPen for performance reasons |
|
|||
97 | m_backgroundShadesPen = Qt::NoPen; |
|
|||
98 | m_backgroundShadesBrush = QBrush(QColor(0xaf, 0xaf, 0xaf, 0x50)); |
|
84 | m_backgroundShadesBrush = QBrush(QColor(0xaf, 0xaf, 0xaf, 0x50)); | |
99 | m_backgroundShades = BackgroundShadesVertical; |
|
85 | m_backgroundShades = BackgroundShadesVertical; | |
100 |
|
86 | |||
@@ -113,13 +99,6 public: | |||||
113 | m_chartBackgroundGradient = backgroundGradient; |
|
99 | m_chartBackgroundGradient = backgroundGradient; | |
114 |
|
100 | |||
115 | // Axes and other |
|
101 | // Axes and other | |
116 | m_masterFont = QFont(); |
|
|||
117 | m_masterFont.setPointSizeF(10.0); |
|
|||
118 | m_axisLinePen = QPen(Qt::black); |
|
|||
119 | m_axisLinePen.setWidth(2); |
|
|||
120 | m_axisLabelBrush = QBrush(Qt::black); |
|
|||
121 | m_axisLabelPen = Qt::NoPen; // NoPen for performance reasons |
|
|||
122 | m_backgroundShadesPen = Qt::NoPen; |
|
|||
123 | m_backgroundShadesBrush = QBrush(QColor(0xaf, 0xaf, 0xaf, 0x50)); |
|
102 | m_backgroundShadesBrush = QBrush(QColor(0xaf, 0xaf, 0xaf, 0x50)); | |
124 | m_backgroundShades = BackgroundShadesVertical; |
|
103 | m_backgroundShades = BackgroundShadesVertical; | |
125 |
|
104 | |||
@@ -138,13 +117,6 public: | |||||
138 | m_backgroundGradient = backgroundGradient; |
|
117 | m_backgroundGradient = backgroundGradient; | |
139 |
|
118 | |||
140 | // Axes and other |
|
119 | // Axes and other | |
141 | m_masterFont = QFont(); |
|
|||
142 | m_masterFont.setPointSizeF(10.0); |
|
|||
143 | m_axisLinePen = QPen(Qt::black); |
|
|||
144 | m_axisLinePen.setWidth(2); |
|
|||
145 | m_axisLabelBrush = QBrush(Qt::black); |
|
|||
146 | m_axisLabelPen = Qt::NoPen; // NoPen for performance reasons |
|
|||
147 | m_backgroundShadesPen = Qt::NoPen; |
|
|||
148 | m_backgroundShadesBrush = QBrush(QColor(0xaf, 0xaf, 0xaf, 0x50)); |
|
120 | m_backgroundShadesBrush = QBrush(QColor(0xaf, 0xaf, 0xaf, 0x50)); | |
149 | m_backgroundShades = BackgroundShadesVertical; |
|
121 | m_backgroundShades = BackgroundShadesVertical; | |
150 | #endif |
|
122 | #endif |
@@ -22,13 +22,9 public: | |||||
22 | m_chartBackgroundGradient = backgroundGradient; |
|
22 | m_chartBackgroundGradient = backgroundGradient; | |
23 |
|
23 | |||
24 | // Axes and other |
|
24 | // Axes and other | |
25 | m_masterFont = QFont(); |
|
|||
26 | m_axisLinePen = QPen(QRgb(0x0f0f0f)); |
|
25 | m_axisLinePen = QPen(QRgb(0x0f0f0f)); | |
27 | m_axisLinePen.setWidth(2); |
|
26 | m_axisLinePen.setWidth(2); | |
28 | m_axisLabelBrush = QBrush(QRgb(0x3f3f3f)); |
|
27 | m_axisLabelBrush = QBrush(QRgb(0x3f3f3f)); | |
29 | m_axisLabelPen = Qt::NoPen; // NoPen for performance reasons |
|
|||
30 | m_backgroundShadesPen = Qt::NoPen; |
|
|||
31 | m_backgroundShades = BackgroundShadesNone; |
|
|||
32 | m_gridLinePen = QPen(QRgb(0x0f0f0f)); |
|
28 | m_gridLinePen = QPen(QRgb(0x0f0f0f)); | |
33 | m_gridLinePen.setWidth(2); |
|
29 | m_gridLinePen.setWidth(2); | |
34 | } |
|
30 | } |
@@ -22,13 +22,9 public: | |||||
22 | m_chartBackgroundGradient = backgroundGradient; |
|
22 | m_chartBackgroundGradient = backgroundGradient; | |
23 |
|
23 | |||
24 | // Axes and other |
|
24 | // Axes and other | |
25 | m_masterFont = QFont(); |
|
|||
26 | m_axisLinePen = QPen(QRgb(0x0f0f0f)); |
|
25 | m_axisLinePen = QPen(QRgb(0x0f0f0f)); | |
27 | m_axisLinePen.setWidth(2); |
|
26 | m_axisLinePen.setWidth(2); | |
28 | m_axisLabelBrush = QBrush(QRgb(0x3f3f3f)); |
|
27 | m_axisLabelBrush = QBrush(QRgb(0x3f3f3f)); | |
29 | m_axisLabelPen = Qt::NoPen; // NoPen for performance reasons |
|
|||
30 | m_backgroundShadesPen = Qt::NoPen; |
|
|||
31 | m_backgroundShades = BackgroundShadesNone; |
|
|||
32 | m_gridLinePen = QPen(QRgb(0x0f0f0f)); |
|
28 | m_gridLinePen = QPen(QRgb(0x0f0f0f)); | |
33 | m_gridLinePen.setWidth(2); |
|
29 | m_gridLinePen.setWidth(2); | |
34 | } |
|
30 | } |
@@ -23,13 +23,10 public: | |||||
23 | m_chartBackgroundGradient = backgroundGradient; |
|
23 | m_chartBackgroundGradient = backgroundGradient; | |
24 |
|
24 | |||
25 | // Axes and other |
|
25 | // Axes and other | |
26 | m_masterFont = QFont(); |
|
26 | m_masterFont = QFont("arial"); | |
27 |
m_axisLinePen = QPen( |
|
27 | m_axisLinePen = QPen(0xd6d6d6); | |
28 | m_axisLinePen.setWidth(1); |
|
28 | m_axisLinePen.setWidth(1); | |
29 |
m_axisLabelBrush = QBrush(QRgb(0x |
|
29 | m_axisLabelBrush = QBrush(QRgb(0x404044)); | |
30 | m_axisLabelPen = Qt::NoPen; // NoPen for performance reasons |
|
|||
31 | m_backgroundShadesPen = Qt::NoPen; |
|
|||
32 | m_backgroundShades = BackgroundShadesNone; |
|
|||
33 | m_gridLinePen = QPen(QRgb(0xe2e2e2)); |
|
30 | m_gridLinePen = QPen(QRgb(0xe2e2e2)); | |
34 | m_gridLinePen.setWidth(1); |
|
31 | m_gridLinePen.setWidth(1); | |
35 | } |
|
32 | } |
@@ -22,13 +22,9 public: | |||||
22 | m_chartBackgroundGradient = backgroundGradient; |
|
22 | m_chartBackgroundGradient = backgroundGradient; | |
23 |
|
23 | |||
24 | // Axes and other |
|
24 | // Axes and other | |
25 | m_masterFont = QFont(); |
|
|||
26 | m_axisLinePen = QPen(QRgb(0x0f0f0f)); |
|
25 | m_axisLinePen = QPen(QRgb(0x0f0f0f)); | |
27 | m_axisLinePen.setWidth(2); |
|
26 | m_axisLinePen.setWidth(2); | |
28 | m_axisLabelBrush = QBrush(QRgb(0x3f3f3f)); |
|
27 | m_axisLabelBrush = QBrush(QRgb(0x3f3f3f)); | |
29 | m_axisLabelPen = Qt::NoPen; // NoPen for performance reasons |
|
|||
30 | m_backgroundShadesPen = Qt::NoPen; |
|
|||
31 | // m_backgroundShadesBrush = QBrush(QColor(0x0f, 0x0f, 0x0f, 0x80)); |
|
|||
32 | m_backgroundShadesBrush = QBrush(QColor(0xff, 0xad, 0x00, 0x50)); |
|
28 | m_backgroundShadesBrush = QBrush(QColor(0xff, 0xad, 0x00, 0x50)); | |
33 | m_backgroundShades = BackgroundShadesHorizontal; |
|
29 | m_backgroundShades = BackgroundShadesHorizontal; | |
34 | m_gridLinePen = QPen(QRgb(0x0f0f0f)); |
|
30 | m_gridLinePen = QPen(QRgb(0x0f0f0f)); |
@@ -23,13 +23,9 public: | |||||
23 | m_chartBackgroundGradient = backgroundGradient; |
|
23 | m_chartBackgroundGradient = backgroundGradient; | |
24 |
|
24 | |||
25 | // Axes and other |
|
25 | // Axes and other | |
26 | m_masterFont = QFont(); |
|
|||
27 | m_axisLinePen = QPen(QRgb(0x0f0f0f)); |
|
26 | m_axisLinePen = QPen(QRgb(0x0f0f0f)); | |
28 | m_axisLinePen.setWidth(2); |
|
27 | m_axisLinePen.setWidth(2); | |
29 | m_axisLabelBrush = QBrush(QRgb(0xa0a071)); |
|
28 | m_axisLabelBrush = QBrush(QRgb(0xa0a071)); | |
30 | m_axisLabelPen = Qt::NoPen; // NoPen for performance reasons |
|
|||
31 | m_backgroundShadesPen = Qt::NoPen; |
|
|||
32 | m_backgroundShades = BackgroundShadesNone; |
|
|||
33 | m_gridLinePen = QPen(QRgb(0x0f0f0f)); |
|
29 | m_gridLinePen = QPen(QRgb(0x0f0f0f)); | |
34 | m_gridLinePen.setWidth(2); |
|
30 | m_gridLinePen.setWidth(2); | |
35 | } |
|
31 | } |
General Comments 0
You need to be logged in to leave comments.
Login now