##// END OF EJS Templates
Fonts and background of the themes...
Tero Ahola -
r614:ac346143dd38
parent child
Show More
@@ -174,6 +174,16 public Q_SLOTS:
174 174 QChart::ChartTheme theme = (QChart::ChartTheme) m_themeComboBox->itemData(m_themeComboBox->currentIndex()).toInt();
175 175 foreach (QChartView *chart, m_charts)
176 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 189 private:
@@ -40,7 +40,15
40 40
41 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 53 m_id = id;
46 54 qsrand(QTime(0,0,0).secsTo(QTime::currentTime()));
@@ -75,6 +83,7 void ChartTheme::decorate(QChart* chart)
75 83 chart->setChartBackgroundBrush(Qt::NoBrush);
76 84 }
77 85 chart->setChartTitleFont(m_masterFont);
86 chart->setChartTitleBrush(m_titleBrush);
78 87 }
79 88
80 89 void ChartTheme::decorate(QLegend* legend)
@@ -214,7 +223,7 void ChartTheme::decorate(QChartAxis* axis,bool axisX)
214 223 {
215 224 if (axis->isAxisVisible()) {
216 225 axis->setLabelsBrush(m_axisLabelBrush);
217 axis->setLabelsPen(m_axisLabelPen);
226 axis->setLabelsPen(Qt::NoPen); // NoPen for performance reasons
218 227 if (m_backgroundShades == BackgroundShadesBoth
219 228 || (m_backgroundShades == BackgroundShadesVertical && axisX)
220 229 || (m_backgroundShades == BackgroundShadesHorizontal && !axisX)) {
@@ -67,9 +67,9 protected:
67 67 QLinearGradient m_chartBackgroundGradient;
68 68
69 69 QFont m_masterFont;
70 QBrush m_titleBrush;
70 71 QPen m_axisLinePen;
71 72 QBrush m_axisLabelBrush;
72 QPen m_axisLabelPen;
73 73 QPen m_backgroundShadesPen;
74 74 QBrush m_backgroundShadesBrush;
75 75 BackgroundShadesMode m_backgroundShades;
@@ -17,19 +17,17 public:
17 17
18 18 // Background
19 19 QLinearGradient backgroundGradient;
20 backgroundGradient.setColorAt(0.0, QRgb(0xd6d6d6));
20 backgroundGradient.setColorAt(0.0, QRgb(0x2e303a));
21 21 backgroundGradient.setColorAt(1.0, QRgb(0x121218));
22 22 backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode);
23 23 m_chartBackgroundGradient = backgroundGradient;
24 24
25 25 // Axes and other
26 m_masterFont = QFont();
26 m_masterFont = QFont("arial");
27 m_titleBrush = QBrush(QRgb(0xffffff));
27 28 m_axisLinePen = QPen(QRgb(0x86878c));
28 29 m_axisLinePen.setWidth(2);
29 m_axisLabelBrush = QBrush(QRgb(0x86878c));
30 m_axisLabelPen = Qt::NoPen; // NoPen for performance reasons
31 m_backgroundShadesPen = Qt::NoPen;
32 m_backgroundShades = BackgroundShadesNone;
30 m_axisLabelBrush = QBrush(QRgb(0xffffff));
33 31 m_gridLinePen = QPen(QRgb(0x86878c));
34 32 m_gridLinePen.setWidth(1);
35 33 }
@@ -9,7 +9,7 QTCOMMERCIALCHART_BEGIN_NAMESPACE
9 9 class ChartThemeDefault: public ChartTheme
10 10 {
11 11 public:
12 ChartThemeDefault():ChartTheme(QChart::ChartThemeDefault)
12 ChartThemeDefault() : ChartTheme(QChart::ChartThemeDefault)
13 13 {
14 14 #ifdef Q_OS_WIN
15 15 // TODO: use theme specific window frame color as a series base color (it would give more
@@ -63,13 +63,6 public:
63 63 GetGValue(colorWindow),
64 64 GetBValue(colorWindow)));
65 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 66 m_backgroundShadesBrush = QBrush(QColor(0xaf, 0xaf, 0xaf, 0x50));
74 67 m_backgroundShades = BackgroundShadesVertical;
75 68
@@ -88,13 +81,6 public:
88 81 m_chartBackgroundGradient = backgroundGradient;
89 82
90 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 84 m_backgroundShadesBrush = QBrush(QColor(0xaf, 0xaf, 0xaf, 0x50));
99 85 m_backgroundShades = BackgroundShadesVertical;
100 86
@@ -113,13 +99,6 public:
113 99 m_chartBackgroundGradient = backgroundGradient;
114 100
115 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 102 m_backgroundShadesBrush = QBrush(QColor(0xaf, 0xaf, 0xaf, 0x50));
124 103 m_backgroundShades = BackgroundShadesVertical;
125 104
@@ -138,13 +117,6 public:
138 117 m_backgroundGradient = backgroundGradient;
139 118
140 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 120 m_backgroundShadesBrush = QBrush(QColor(0xaf, 0xaf, 0xaf, 0x50));
149 121 m_backgroundShades = BackgroundShadesVertical;
150 122 #endif
@@ -5,7 +5,7 QTCOMMERCIALCHART_BEGIN_NAMESPACE
5 5 class ChartThemeGrayscale: public ChartTheme
6 6 {
7 7 public:
8 ChartThemeGrayscale():ChartTheme(QChart::ChartThemeGrayscale)
8 ChartThemeGrayscale() : ChartTheme(QChart::ChartThemeGrayscale)
9 9 {
10 10 // Series colors
11 11 m_seriesColors << QRgb(0x869299);
@@ -22,13 +22,9 public:
22 22 m_chartBackgroundGradient = backgroundGradient;
23 23
24 24 // Axes and other
25 m_masterFont = QFont();
26 25 m_axisLinePen = QPen(QRgb(0x0f0f0f));
27 26 m_axisLinePen.setWidth(2);
28 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 28 m_gridLinePen = QPen(QRgb(0x0f0f0f));
33 29 m_gridLinePen.setWidth(2);
34 30 }
@@ -5,7 +5,7 QTCOMMERCIALCHART_BEGIN_NAMESPACE
5 5 class ChartThemeIcy: public ChartTheme
6 6 {
7 7 public:
8 ChartThemeIcy():ChartTheme(QChart::ChartThemeIcy)
8 ChartThemeIcy() : ChartTheme(QChart::ChartThemeIcy)
9 9 {
10 10 // Series
11 11 m_seriesColors << QRgb(0x0d2673);
@@ -22,13 +22,9 public:
22 22 m_chartBackgroundGradient = backgroundGradient;
23 23
24 24 // Axes and other
25 m_masterFont = QFont();
26 25 m_axisLinePen = QPen(QRgb(0x0f0f0f));
27 26 m_axisLinePen.setWidth(2);
28 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 28 m_gridLinePen = QPen(QRgb(0x0f0f0f));
33 29 m_gridLinePen.setWidth(2);
34 30 }
@@ -23,13 +23,10 public:
23 23 m_chartBackgroundGradient = backgroundGradient;
24 24
25 25 // Axes and other
26 m_masterFont = QFont();
27 m_axisLinePen = QPen(QRgb(0xe2e2e2));
26 m_masterFont = QFont("arial");
27 m_axisLinePen = QPen(0xd6d6d6);
28 28 m_axisLinePen.setWidth(1);
29 m_axisLabelBrush = QBrush(QRgb(0x838383));
30 m_axisLabelPen = Qt::NoPen; // NoPen for performance reasons
31 m_backgroundShadesPen = Qt::NoPen;
32 m_backgroundShades = BackgroundShadesNone;
29 m_axisLabelBrush = QBrush(QRgb(0x404044));
33 30 m_gridLinePen = QPen(QRgb(0xe2e2e2));
34 31 m_gridLinePen.setWidth(1);
35 32 }
@@ -5,7 +5,7 QTCOMMERCIALCHART_BEGIN_NAMESPACE
5 5 class ChartThemeScientific: public ChartTheme
6 6 {
7 7 public:
8 ChartThemeScientific():ChartTheme(QChart::ChartThemeScientific)
8 ChartThemeScientific() : ChartTheme(QChart::ChartThemeScientific)
9 9 {
10 10 // Series
11 11 m_seriesColors << QRgb(0xFFAD00);
@@ -22,13 +22,9 public:
22 22 m_chartBackgroundGradient = backgroundGradient;
23 23
24 24 // Axes and other
25 m_masterFont = QFont();
26 25 m_axisLinePen = QPen(QRgb(0x0f0f0f));
27 26 m_axisLinePen.setWidth(2);
28 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 28 m_backgroundShadesBrush = QBrush(QColor(0xff, 0xad, 0x00, 0x50));
33 29 m_backgroundShades = BackgroundShadesHorizontal;
34 30 m_gridLinePen = QPen(QRgb(0x0f0f0f));
@@ -5,7 +5,7 QTCOMMERCIALCHART_BEGIN_NAMESPACE
5 5 class ChartThemeVanilla: public ChartTheme
6 6 {
7 7 public:
8 ChartThemeVanilla():ChartTheme(QChart::ChartThemeVanilla)
8 ChartThemeVanilla() : ChartTheme(QChart::ChartThemeVanilla)
9 9 {
10 10 // Series
11 11 m_seriesColors << QRgb(0xd9c574);
@@ -23,13 +23,9 public:
23 23 m_chartBackgroundGradient = backgroundGradient;
24 24
25 25 // Axes and other
26 m_masterFont = QFont();
27 26 m_axisLinePen = QPen(QRgb(0x0f0f0f));
28 27 m_axisLinePen.setWidth(2);
29 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 29 m_gridLinePen = QPen(QRgb(0x0f0f0f));
34 30 m_gridLinePen.setWidth(2);
35 31 }
General Comments 0
You need to be logged in to leave comments. Login now