##// END OF EJS Templates
Three more themes
Tero Ahola -
r651:17e2918b5f02
parent child
Show More
@@ -0,0 +1,36
1 #include "charttheme_p.h"
2
3 QTCOMMERCIALCHART_BEGIN_NAMESPACE
4
5 class ChartThemeBlueNcs: public ChartTheme
6 {
7 public:
8 ChartThemeBlueNcs() : ChartTheme(QChart::ChartThemeBlueNcs)
9 {
10 // Series colors
11 m_seriesColors << QRgb(0x1db0da);
12 m_seriesColors << QRgb(0x1341a6);
13 m_seriesColors << QRgb(0x88d41e);
14 m_seriesColors << QRgb(0xff8e1a);
15 m_seriesColors << QRgb(0x398ca3);
16 generateSeriesGradients();
17
18 // Background
19 QLinearGradient backgroundGradient;
20 backgroundGradient.setColorAt(0.0, QRgb(0xffffff));
21 backgroundGradient.setColorAt(1.0, QRgb(0xffffff));
22 backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode);
23 m_chartBackgroundGradient = backgroundGradient;
24
25 // Axes and other
26 m_masterFont = QFont("arial");
27 m_titleBrush = QBrush(QRgb(0x404044));
28 m_axisLinePen = QPen(QRgb(0xd6d6d6));
29 m_axisLinePen.setWidth(2);
30 m_axisLabelBrush = QBrush(QRgb(0x404044));
31 m_gridLinePen = QPen(QRgb(0xe2e2e2));
32 m_gridLinePen.setWidth(1);
33 }
34 };
35
36 QTCOMMERCIALCHART_END_NAMESPACE
@@ -0,0 +1,36
1 #include "charttheme_p.h"
2
3 QTCOMMERCIALCHART_BEGIN_NAMESPACE
4
5 class ChartThemeBrownSand: public ChartTheme
6 {
7 public:
8 ChartThemeBrownSand() : ChartTheme(QChart::ChartThemeBrownSand)
9 {
10 // Series colors
11 m_seriesColors << QRgb(0xb39b72);
12 m_seriesColors << QRgb(0xb3b376);
13 m_seriesColors << QRgb(0xc35660);
14 m_seriesColors << QRgb(0x536780);
15 m_seriesColors << QRgb(0x494345);
16 generateSeriesGradients();
17
18 // Background
19 QLinearGradient backgroundGradient;
20 backgroundGradient.setColorAt(0.0, QRgb(0xf3ece0));
21 backgroundGradient.setColorAt(1.0, QRgb(0xf3ece0));
22 backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode);
23 m_chartBackgroundGradient = backgroundGradient;
24
25 // Axes and other
26 m_masterFont = QFont("arial");
27 m_titleBrush = QBrush(QRgb(0x404044));
28 m_axisLinePen = QPen(QRgb(0xb5b0a7));
29 m_axisLinePen.setWidth(2);
30 m_axisLabelBrush = QBrush(QRgb(0x404044));
31 m_gridLinePen = QPen(QRgb(0xd4cec3));
32 m_gridLinePen.setWidth(1);
33 }
34 };
35
36 QTCOMMERCIALCHART_END_NAMESPACE
@@ -0,0 +1,36
1 #include "charttheme_p.h"
2
3 QTCOMMERCIALCHART_BEGIN_NAMESPACE
4
5 class ChartThemeDark : public ChartTheme
6 {
7 public:
8 ChartThemeDark() : ChartTheme(QChart::ChartThemeDark)
9 {
10 // Series colors
11 m_seriesColors << QRgb(0x38ad6b);
12 m_seriesColors << QRgb(0x3c84a7);
13 m_seriesColors << QRgb(0xeb8817);
14 m_seriesColors << QRgb(0x7b7f8c);
15 m_seriesColors << QRgb(0xbf593e);
16 generateSeriesGradients();
17
18 // Background
19 QLinearGradient backgroundGradient;
20 backgroundGradient.setColorAt(0.0, QRgb(0x2e303a));
21 backgroundGradient.setColorAt(1.0, QRgb(0x121218));
22 backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode);
23 m_chartBackgroundGradient = backgroundGradient;
24
25 // Axes and other
26 m_masterFont = QFont("arial");
27 m_titleBrush = QBrush(QRgb(0xffffff));
28 m_axisLinePen = QPen(QRgb(0x86878c));
29 m_axisLinePen.setWidth(2);
30 m_axisLabelBrush = QBrush(QRgb(0xffffff));
31 m_gridLinePen = QPen(QRgb(0x86878c));
32 m_gridLinePen.setWidth(1);
33 }
34 };
35
36 QTCOMMERCIALCHART_END_NAMESPACE
@@ -57,12 +57,15 public:
57 // settings layout
57 // settings layout
58 m_themeComboBox = new QComboBox();
58 m_themeComboBox = new QComboBox();
59 m_themeComboBox->addItem("Default", QChart::ChartThemeDefault);
59 m_themeComboBox->addItem("Default", QChart::ChartThemeDefault);
60 m_themeComboBox->addItem("Light", QChart::ChartThemeLight);
61 m_themeComboBox->addItem("Blue Cerulean", QChart::ChartThemeBlueCerulean);
62 m_themeComboBox->addItem("Dark", QChart::ChartThemeDark);
63 m_themeComboBox->addItem("Brown Sand", QChart::ChartThemeBrownSand);
64 m_themeComboBox->addItem("Blue NCS", QChart::ChartThemeBlueNcs);
60 m_themeComboBox->addItem("Vanilla", QChart::ChartThemeVanilla);
65 m_themeComboBox->addItem("Vanilla", QChart::ChartThemeVanilla);
61 m_themeComboBox->addItem("Icy", QChart::ChartThemeIcy);
66 m_themeComboBox->addItem("Icy", QChart::ChartThemeIcy);
62 m_themeComboBox->addItem("Grayscale", QChart::ChartThemeGrayscale);
67 m_themeComboBox->addItem("Grayscale", QChart::ChartThemeGrayscale);
63 m_themeComboBox->addItem("Scientific", QChart::ChartThemeScientific);
68 m_themeComboBox->addItem("Scientific", QChart::ChartThemeScientific);
64 m_themeComboBox->addItem("Blue Cerulean", QChart::ChartThemeBlueCerulean);
65 m_themeComboBox->addItem("Light", QChart::ChartThemeLight);
66 connect(m_themeComboBox, SIGNAL(currentIndexChanged(int)), this ,SLOT(updateTheme()));
69 connect(m_themeComboBox, SIGNAL(currentIndexChanged(int)), this ,SLOT(updateTheme()));
67 QCheckBox *antialiasCheckBox = new QCheckBox("Anti aliasing");
70 QCheckBox *antialiasCheckBox = new QCheckBox("Anti aliasing");
68 connect(antialiasCheckBox, SIGNAL(toggled(bool)), this ,SLOT(updateAntialiasing(bool)));
71 connect(antialiasCheckBox, SIGNAL(toggled(bool)), this ,SLOT(updateAntialiasing(bool)));
@@ -178,9 +181,21 public Q_SLOTS:
178 chart->setChartTheme(theme);
181 chart->setChartTheme(theme);
179
182
180 QPalette pal = window()->palette();
183 QPalette pal = window()->palette();
181 if (theme == QChart::ChartThemeBlueCerulean) {
184 if (theme == QChart::ChartThemeLight) {
185 pal.setColor(QPalette::Window, QRgb(0xf0f0f0));
186 pal.setColor(QPalette::WindowText, QRgb(0x404044));
187 } else if (theme == QChart::ChartThemeDark) {
182 pal.setColor(QPalette::Window, QRgb(0x121218));
188 pal.setColor(QPalette::Window, QRgb(0x121218));
183 pal.setColor(QPalette::WindowText, QRgb(0xd6d6d6));
189 pal.setColor(QPalette::WindowText, QRgb(0xd6d6d6));
190 } else if (theme == QChart::ChartThemeBlueCerulean) {
191 pal.setColor(QPalette::Window, QRgb(0x40434a));
192 pal.setColor(QPalette::WindowText, QRgb(0xd6d6d6));
193 } else if (theme == QChart::ChartThemeBrownSand) {
194 pal.setColor(QPalette::Window, QRgb(0x9e8965));
195 pal.setColor(QPalette::WindowText, QRgb(0x404044));
196 } else if (theme == QChart::ChartThemeBlueNcs) {
197 pal.setColor(QPalette::Window, QRgb(0x018bba));
198 pal.setColor(QPalette::WindowText, QRgb(0x404044));
184 } else {
199 } else {
185 pal.setColor(QPalette::Window, QRgb(0xf0f0f0));
200 pal.setColor(QPalette::Window, QRgb(0xf0f0f0));
186 pal.setColor(QPalette::WindowText, QRgb(0x404044));
201 pal.setColor(QPalette::WindowText, QRgb(0x404044));
@@ -18,12 +18,15 class DeclarativeChart : public QDeclarativeItem
18 public:
18 public:
19 enum ChartTheme {
19 enum ChartTheme {
20 ThemeDefault,
20 ThemeDefault,
21 ThemeLight,
22 ThemeBlueCerulean,
23 ThemeDark,
24 ThemeBrownSand,
25 ThemeBlueNcs,
21 ThemeVanilla,
26 ThemeVanilla,
22 ThemeIcy,
27 ThemeIcy,
23 ThemeGrayscale,
28 ThemeGrayscale,
24 ThemeScientific,
29 ThemeScientific
25 ThemeBlueCerulean,
26 ThemeLight
27 };
30 };
28 DeclarativeChart(QDeclarativeItem *parent = 0);
31 DeclarativeChart(QDeclarativeItem *parent = 0);
29
32
@@ -30,13 +30,15
30
30
31 //themes
31 //themes
32 #include "chartthemedefault_p.h"
32 #include "chartthemedefault_p.h"
33 #include "chartthemelight_p.h"
34 #include "chartthemebluecerulean_p.h"
35 #include "chartthemedark_p.h"
36 #include "chartthemebrownsand_p.h"
37 #include "chartthemebluencs_p.h"
33 #include "chartthemevanilla_p.h"
38 #include "chartthemevanilla_p.h"
34 #include "chartthemeicy_p.h"
39 #include "chartthemeicy_p.h"
35 #include "chartthemegrayscale_p.h"
40 #include "chartthemegrayscale_p.h"
36 #include "chartthemescientific_p.h"
41 #include "chartthemescientific_p.h"
37 #include "chartthemebluecerulean_p.h"
38 #include "chartthemelight_p.h"
39
40
42
41 QTCOMMERCIALCHART_BEGIN_NAMESPACE
43 QTCOMMERCIALCHART_BEGIN_NAMESPACE
42
44
@@ -58,6 +60,16 ChartTheme::ChartTheme(QChart::ChartTheme id) :
58 ChartTheme* ChartTheme::createTheme(QChart::ChartTheme theme)
60 ChartTheme* ChartTheme::createTheme(QChart::ChartTheme theme)
59 {
61 {
60 switch(theme) {
62 switch(theme) {
63 case QChart::ChartThemeLight:
64 return new ChartThemeLight();
65 case QChart::ChartThemeBlueCerulean:
66 return new ChartThemeBlueCerulean();
67 case QChart::ChartThemeDark:
68 return new ChartThemeDark();
69 case QChart::ChartThemeBrownSand:
70 return new ChartThemeBrownSand();
71 case QChart::ChartThemeBlueNcs:
72 return new ChartThemeBlueNcs();
61 case QChart::ChartThemeVanilla:
73 case QChart::ChartThemeVanilla:
62 return new ChartThemeVanilla();
74 return new ChartThemeVanilla();
63 case QChart::ChartThemeIcy:
75 case QChart::ChartThemeIcy:
@@ -66,10 +78,6 ChartTheme* ChartTheme::createTheme(QChart::ChartTheme theme)
66 return new ChartThemeGrayscale();
78 return new ChartThemeGrayscale();
67 case QChart::ChartThemeScientific:
79 case QChart::ChartThemeScientific:
68 return new ChartThemeScientific();
80 return new ChartThemeScientific();
69 case QChart::ChartThemeBlueCerulean:
70 return new ChartThemeBlueCerulean();
71 case QChart::ChartThemeLight:
72 return new ChartThemeLight();
73 default:
81 default:
74 return new ChartThemeDefault();
82 return new ChartThemeDefault();
75 }
83 }
@@ -30,12 +30,15 class QTCOMMERCIALCHART_EXPORT QChart : public QGraphicsWidget
30 public:
30 public:
31 enum ChartTheme {
31 enum ChartTheme {
32 ChartThemeDefault,
32 ChartThemeDefault,
33 ChartThemeLight,
34 ChartThemeBlueCerulean,
35 ChartThemeDark,
36 ChartThemeBrownSand,
37 ChartThemeBlueNcs,
33 ChartThemeVanilla,
38 ChartThemeVanilla,
34 ChartThemeIcy,
39 ChartThemeIcy,
35 ChartThemeGrayscale,
40 ChartThemeGrayscale,
36 ChartThemeScientific,
41 ChartThemeScientific,
37 ChartThemeBlueCerulean,
38 ChartThemeLight,
39 ChartThemeCount
42 ChartThemeCount
40 };
43 };
41
44
@@ -44,12 +44,15 include(scatterseries/scatter.pri)
44 include(splinechart/splinechart.pri)
44 include(splinechart/splinechart.pri)
45
45
46 THEMES += themes/chartthemedefault_p.h \
46 THEMES += themes/chartthemedefault_p.h \
47 themes/chartthemelight_p.h \
48 themes/chartthemebluecerulean_p.h \
49 themes/chartthemedark_p.h \
50 themes/chartthemebrownsand_p.h \
51 themes/chartthemebluencs_p.h \
47 themes/chartthemeicy_p.h \
52 themes/chartthemeicy_p.h \
48 themes/chartthemegrayscale_p.h \
53 themes/chartthemegrayscale_p.h \
49 themes/chartthemescientific_p.h \
54 themes/chartthemescientific_p.h \
50 themes/chartthemevanilla_p.h \
55 themes/chartthemevanilla_p.h
51 themes/chartthemebluecerulean_p.h \
52 themes/chartthemelight_p.h
53
56
54 HEADERS += $$PUBLIC_HEADERS
57 HEADERS += $$PUBLIC_HEADERS
55 HEADERS += $$PRIVATE_HEADERS
58 HEADERS += $$PRIVATE_HEADERS
@@ -8,27 +8,27 public:
8 ChartThemeBlueCerulean() : ChartTheme(QChart::ChartThemeBlueCerulean)
8 ChartThemeBlueCerulean() : ChartTheme(QChart::ChartThemeBlueCerulean)
9 {
9 {
10 // Series colors
10 // Series colors
11 m_seriesColors << QRgb(0x38ad6b);
11 m_seriesColors << QRgb(0xc7e85b);
12 m_seriesColors << QRgb(0x3c84a7);
12 m_seriesColors << QRgb(0x1cb54f);
13 m_seriesColors << QRgb(0xeb8817);
13 m_seriesColors << QRgb(0x5cbf9b);
14 m_seriesColors << QRgb(0x7b7f8c);
14 m_seriesColors << QRgb(0x009fbf);
15 m_seriesColors << QRgb(0xbf593e);
15 m_seriesColors << QRgb(0xee7392);
16 generateSeriesGradients();
16 generateSeriesGradients();
17
17
18 // Background
18 // Background
19 QLinearGradient backgroundGradient;
19 QLinearGradient backgroundGradient;
20 backgroundGradient.setColorAt(0.0, QRgb(0x2e303a));
20 backgroundGradient.setColorAt(0.0, QRgb(0x056189));
21 backgroundGradient.setColorAt(1.0, QRgb(0x121218));
21 backgroundGradient.setColorAt(1.0, QRgb(0x101a31));
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("arial");
26 m_masterFont = QFont("arial");
27 m_titleBrush = QBrush(QRgb(0xffffff));
27 m_titleBrush = QBrush(QRgb(0xffffff));
28 m_axisLinePen = QPen(QRgb(0x86878c));
28 m_axisLinePen = QPen(QRgb(0xd6d6d6));
29 m_axisLinePen.setWidth(2);
29 m_axisLinePen.setWidth(2);
30 m_axisLabelBrush = QBrush(QRgb(0xffffff));
30 m_axisLabelBrush = QBrush(QRgb(0xffffff));
31 m_gridLinePen = QPen(QRgb(0x86878c));
31 m_gridLinePen = QPen(QRgb(0x84a2b0));
32 m_gridLinePen.setWidth(1);
32 m_gridLinePen.setWidth(1);
33 }
33 }
34 };
34 };
General Comments 0
You need to be logged in to leave comments. Login now