##// END OF EJS Templates
Added Icy Blue and High Contrast theme
Tero Ahola -
r757:7dda437b6dfe
parent child
Show More
@@ -158,8 +158,8 QComboBox* ThemeWidget::createThemeBox() const
158 themeComboBox->addItem("Dark", QChart::ChartThemeDark);
158 themeComboBox->addItem("Dark", QChart::ChartThemeDark);
159 themeComboBox->addItem("Brown Sand", QChart::ChartThemeBrownSand);
159 themeComboBox->addItem("Brown Sand", QChart::ChartThemeBrownSand);
160 themeComboBox->addItem("Blue NCS", QChart::ChartThemeBlueNcs);
160 themeComboBox->addItem("Blue NCS", QChart::ChartThemeBlueNcs);
161 themeComboBox->addItem("Icy", QChart::ChartThemeIcy);
161 themeComboBox->addItem("High Contrast", QChart::ChartThemeHighContrast);
162 themeComboBox->addItem("Scientific", QChart::ChartThemeScientific);
162 themeComboBox->addItem("Blue Icy", QChart::ChartThemeBlueIcy);
163 return themeComboBox;
163 return themeComboBox;
164 }
164 }
165
165
@@ -294,24 +294,25 void ThemeWidget::updateUI()
294 if (theme == QChart::ChartThemeLight) {
294 if (theme == QChart::ChartThemeLight) {
295 pal.setColor(QPalette::Window, QRgb(0xf0f0f0));
295 pal.setColor(QPalette::Window, QRgb(0xf0f0f0));
296 pal.setColor(QPalette::WindowText, QRgb(0x404044));
296 pal.setColor(QPalette::WindowText, QRgb(0x404044));
297 }
297 } else if (theme == QChart::ChartThemeDark) {
298 else if (theme == QChart::ChartThemeDark) {
299 pal.setColor(QPalette::Window, QRgb(0x121218));
298 pal.setColor(QPalette::Window, QRgb(0x121218));
300 pal.setColor(QPalette::WindowText, QRgb(0xd6d6d6));
299 pal.setColor(QPalette::WindowText, QRgb(0xd6d6d6));
301 }
300 } else if (theme == QChart::ChartThemeBlueCerulean) {
302 else if (theme == QChart::ChartThemeBlueCerulean) {
303 pal.setColor(QPalette::Window, QRgb(0x40434a));
301 pal.setColor(QPalette::Window, QRgb(0x40434a));
304 pal.setColor(QPalette::WindowText, QRgb(0xd6d6d6));
302 pal.setColor(QPalette::WindowText, QRgb(0xd6d6d6));
305 }
303 } else if (theme == QChart::ChartThemeBrownSand) {
306 else if (theme == QChart::ChartThemeBrownSand) {
307 pal.setColor(QPalette::Window, QRgb(0x9e8965));
304 pal.setColor(QPalette::Window, QRgb(0x9e8965));
308 pal.setColor(QPalette::WindowText, QRgb(0x404044));
305 pal.setColor(QPalette::WindowText, QRgb(0x404044));
309 }
306 } else if (theme == QChart::ChartThemeBlueNcs) {
310 else if (theme == QChart::ChartThemeBlueNcs) {
311 pal.setColor(QPalette::Window, QRgb(0x018bba));
307 pal.setColor(QPalette::Window, QRgb(0x018bba));
312 pal.setColor(QPalette::WindowText, QRgb(0x404044));
308 pal.setColor(QPalette::WindowText, QRgb(0x404044));
313 }
309 } else if (theme == QChart::ChartThemeHighContrast) {
314 else {
310 pal.setColor(QPalette::Window, QRgb(0xffab03));
311 pal.setColor(QPalette::WindowText, QRgb(0x181818));
312 } else if (theme == QChart::ChartThemeBlueIcy) {
313 pal.setColor(QPalette::Window, QRgb(0xcee7f0));
314 pal.setColor(QPalette::WindowText, QRgb(0x404044));
315 } else {
315 pal.setColor(QPalette::Window, QRgb(0xf0f0f0));
316 pal.setColor(QPalette::Window, QRgb(0xf0f0f0));
316 pal.setColor(QPalette::WindowText, QRgb(0x404044));
317 pal.setColor(QPalette::WindowText, QRgb(0x404044));
317 }
318 }
@@ -309,8 +309,8 public:
309 m_themeComboBox->addItem("Dark", QChart::ChartThemeDark);
309 m_themeComboBox->addItem("Dark", QChart::ChartThemeDark);
310 m_themeComboBox->addItem("BrownSand", QChart::ChartThemeBrownSand);
310 m_themeComboBox->addItem("BrownSand", QChart::ChartThemeBrownSand);
311 m_themeComboBox->addItem("BlueNcs", QChart::ChartThemeBlueNcs);
311 m_themeComboBox->addItem("BlueNcs", QChart::ChartThemeBlueNcs);
312 m_themeComboBox->addItem("Icy", QChart::ChartThemeIcy);
312 m_themeComboBox->addItem("High Contrast", QChart::ChartThemeHighContrast);
313 m_themeComboBox->addItem("Scientific", QChart::ChartThemeScientific);
313 m_themeComboBox->addItem("Blue Icy", QChart::ChartThemeBlueIcy);
314
314
315 m_aaCheckBox = new QCheckBox();
315 m_aaCheckBox = new QCheckBox();
316 m_animationsCheckBox = new QCheckBox();
316 m_animationsCheckBox = new QCheckBox();
@@ -31,7 +31,7 int main(int argc, char *argv[])
31 chartView->setChartTitle("\'Scietific\' theme");
31 chartView->setChartTitle("\'Scietific\' theme");
32 //! [2]
32 //! [2]
33 // Change theme
33 // Change theme
34 chartView->setChartTheme(QChart::ChartThemeScientific);
34 chartView->setChartTheme(QChart::ChartThemeHighContrast);
35 //! [2]
35 //! [2]
36
36
37 chartView->setChartTitle("Simple Pie Chart");
37 chartView->setChartTitle("Simple Pie Chart");
@@ -24,7 +24,7 MainWindow::MainWindow(QWidget *parent)
24 // Create chart view
24 // Create chart view
25 //! [4]
25 //! [4]
26 m_chartView = new QChartView(this);
26 m_chartView = new QChartView(this);
27 m_chartView->setChartTheme(QChart::ChartThemeScientific);
27 m_chartView->setChartTheme(QChart::ChartThemeHighContrast);
28 //! [4]
28 //! [4]
29 setCentralWidget(m_chartView);
29 setCentralWidget(m_chartView);
30 m_chartView->setChartTitle("Custom colors example");
30 m_chartView->setChartTitle("Custom colors example");
@@ -74,7 +74,7 int main(int argc, char *argv[])
74 series->addBarSet(set2);
74 series->addBarSet(set2);
75 series->addBarSet(set3);
75 series->addBarSet(set3);
76 series->addBarSet(set4);
76 series->addBarSet(set4);
77 //! [3]
77 //![3]
78 //![4]
78 //![4]
79 QChart* chart = new QChart();
79 QChart* chart = new QChart();
80 chart->addSeries(series);
80 chart->addSeries(series);
@@ -70,7 +70,7 int main(int argc, char *argv[])
70 QMainWindow window;
70 QMainWindow window;
71
71
72 DrilldownChart* drilldownChart = new DrilldownChart(&window);
72 DrilldownChart* drilldownChart = new DrilldownChart(&window);
73 drilldownChart->setChartTheme(QChart::ChartThemeIcy);
73 drilldownChart->setChartTheme(QChart::ChartThemeBlueIcy);
74
74
75 //! [3]
75 //! [3]
76 // Define categories
76 // Define categories
@@ -23,8 +23,8 public:
23 ThemeDark,
23 ThemeDark,
24 ThemeBrownSand,
24 ThemeBrownSand,
25 ThemeBlueNcs,
25 ThemeBlueNcs,
26 ThemeIcy,
26 ThemeHighContrast,
27 ThemeScientific
27 ThemeBlueIcy
28 };
28 };
29 DeclarativeChart(QDeclarativeItem *parent = 0);
29 DeclarativeChart(QDeclarativeItem *parent = 0);
30 ~DeclarativeChart();
30 ~DeclarativeChart();
@@ -35,8 +35,8
35 #include "chartthemedark_p.h"
35 #include "chartthemedark_p.h"
36 #include "chartthemebrownsand_p.h"
36 #include "chartthemebrownsand_p.h"
37 #include "chartthemebluencs_p.h"
37 #include "chartthemebluencs_p.h"
38 #include "chartthemeicy_p.h"
38 #include "chartthemehighcontrast_p.h"
39 #include "chartthemescientific_p.h"
39 #include "chartthemeblueicy_p.h"
40
40
41 QTCOMMERCIALCHART_BEGIN_NAMESPACE
41 QTCOMMERCIALCHART_BEGIN_NAMESPACE
42
42
@@ -69,10 +69,10 ChartTheme* ChartTheme::createTheme(QChart::ChartTheme theme)
69 return new ChartThemeBrownSand();
69 return new ChartThemeBrownSand();
70 case QChart::ChartThemeBlueNcs:
70 case QChart::ChartThemeBlueNcs:
71 return new ChartThemeBlueNcs();
71 return new ChartThemeBlueNcs();
72 case QChart::ChartThemeIcy:
72 case QChart::ChartThemeHighContrast:
73 return new ChartThemeIcy();
73 return new ChartThemeHighContrast();
74 case QChart::ChartThemeScientific:
74 case QChart::ChartThemeBlueIcy:
75 return new ChartThemeScientific();
75 return new ChartThemeBlueIcy();
76 default:
76 default:
77 return new ChartThemeDefault();
77 return new ChartThemeDefault();
78 }
78 }
@@ -80,18 +80,10 ChartTheme* ChartTheme::createTheme(QChart::ChartTheme theme)
80
80
81 void ChartTheme::decorate(QChart* chart,bool force)
81 void ChartTheme::decorate(QChart* chart,bool force)
82 {
82 {
83 QPen pen;
84 QBrush brush;
83 QBrush brush;
85
84
86 if(brush == chart->backgroundBrush() || force)
85 if(brush == chart->backgroundBrush() || force)
87 {
86 chart->setBackgroundBrush(m_chartBackgroundGradient);
88 if (m_backgroundShades == BackgroundShadesNone) {
89 chart->setBackgroundBrush(m_chartBackgroundGradient);
90 }
91 else {
92 chart->setBackgroundBrush(Qt::NoBrush);
93 }
94 }
95 chart->setTitleFont(m_masterFont);
87 chart->setTitleFont(m_masterFont);
96 chart->setTitleBrush(m_titleBrush);
88 chart->setTitleBrush(m_titleBrush);
97 }
89 }
@@ -36,8 +36,8 QTCOMMERCIALCHART_BEGIN_NAMESPACE
36 \value ChartThemeDark
36 \value ChartThemeDark
37 \value ChartThemeBrownSand
37 \value ChartThemeBrownSand
38 \value ChartThemeBlueNcs
38 \value ChartThemeBlueNcs
39 \value ChartThemeIcy
39 \value ChartThemeHighContrast
40 \value ChartThemeScientific
40 \value ChartThemeBlueIcy
41 \value ChartThemeCount Not really a theme; the total count of themes.
41 \value ChartThemeCount Not really a theme; the total count of themes.
42 */
42 */
43
43
@@ -44,8 +44,8 public:
44 ChartThemeDark,
44 ChartThemeDark,
45 ChartThemeBrownSand,
45 ChartThemeBrownSand,
46 ChartThemeBlueNcs,
46 ChartThemeBlueNcs,
47 ChartThemeIcy,
47 ChartThemeHighContrast,
48 ChartThemeScientific,
48 ChartThemeBlueIcy,
49 ChartThemeCount
49 ChartThemeCount
50 };
50 };
51
51
@@ -2,31 +2,33
2
2
3 QTCOMMERCIALCHART_BEGIN_NAMESPACE
3 QTCOMMERCIALCHART_BEGIN_NAMESPACE
4
4
5 class ChartThemeIcy: public ChartTheme
5 class ChartThemeBlueIcy: public ChartTheme
6 {
6 {
7 public:
7 public:
8 ChartThemeIcy() : ChartTheme(QChart::ChartThemeIcy)
8 ChartThemeBlueIcy() : ChartTheme(QChart::ChartThemeBlueIcy)
9 {
9 {
10 // Series
10 // Series colors
11 m_seriesColors << QRgb(0x0d2673);
11 m_seriesColors << QRgb(0x3daeda);
12 m_seriesColors << QRgb(0x2685bf);
12 m_seriesColors << QRgb(0x2685bf);
13 m_seriesColors << QRgb(0x3dadd9);
13 m_seriesColors << QRgb(0x0c2673);
14 m_seriesColors << QRgb(0x62c3d9);
14 m_seriesColors << QRgb(0x5f3dba);
15 m_seriesColors << QRgb(0x2fa3b4);
15 generateSeriesGradients();
16 generateSeriesGradients();
16
17
17 // Background
18 // Background
18 QLinearGradient backgroundGradient;
19 QLinearGradient backgroundGradient(0.5, 0.0, 0.5, 1.0);
19 backgroundGradient.setColorAt(0.0, QRgb(0xebebeb));
20 backgroundGradient.setColorAt(0.0, QRgb(0xffffff));
20 backgroundGradient.setColorAt(1.0, QRgb(0xf8f9fb));
21 backgroundGradient.setColorAt(1.0, QRgb(0xffffff));
21 backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode);
22 backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode);
22 m_chartBackgroundGradient = backgroundGradient;
23 m_chartBackgroundGradient = backgroundGradient;
23
24
24 // Axes and other
25 // Axes and other
25 m_axisLinePen = QPen(QRgb(0x0f0f0f));
26 m_titleBrush = QBrush(QRgb(0x404044));
27 m_axisLinePen = QPen(QRgb(0xd6d6d6));
26 m_axisLinePen.setWidth(2);
28 m_axisLinePen.setWidth(2);
27 m_axisLabelBrush = QBrush(QRgb(0x3f3f3f));
29 m_axisLabelBrush = QBrush(QRgb(0x404044));
28 m_gridLinePen = QPen(QRgb(0x0f0f0f));
30 m_gridLinePen = QPen(QRgb(0xe2e2e2));
29 m_gridLinePen.setWidth(2);
31 m_gridLinePen.setWidth(1);
30 m_backgroundShades = BackgroundShadesNone;
32 m_backgroundShades = BackgroundShadesNone;
31 }
33 }
32 };
34 };
@@ -2,32 +2,34
2
2
3 QTCOMMERCIALCHART_BEGIN_NAMESPACE
3 QTCOMMERCIALCHART_BEGIN_NAMESPACE
4
4
5 class ChartThemeScientific: public ChartTheme
5 class ChartThemeHighContrast : public ChartTheme
6 {
6 {
7 public:
7 public:
8 ChartThemeScientific() : ChartTheme(QChart::ChartThemeScientific)
8 ChartThemeHighContrast() : ChartTheme(QChart::ChartThemeHighContrast)
9 {
9 {
10 // Series
10 // Series colors
11 m_seriesColors << QRgb(0xFFAD00);
12 m_seriesColors << QRgb(0x596A75);
13 m_seriesColors << QRgb(0x202020);
11 m_seriesColors << QRgb(0x202020);
14 m_seriesColors << QRgb(0x474747);
12 m_seriesColors << QRgb(0x596a74);
13 m_seriesColors << QRgb(0xffab03);
14 m_seriesColors << QRgb(0x038e9b);
15 m_seriesColors << QRgb(0xff4a41);
15 generateSeriesGradients();
16 generateSeriesGradients();
16
17
17 // Background
18 // Background
18 QLinearGradient backgroundGradient;
19 QLinearGradient backgroundGradient(0.5, 0.0, 0.5, 1.0);
19 backgroundGradient.setColorAt(0.0, QRgb(0xfffefc));
20 backgroundGradient.setColorAt(0.0, QRgb(0xffffff));
20 backgroundGradient.setColorAt(1.0, QRgb(0xfffefc));
21 backgroundGradient.setColorAt(1.0, QRgb(0xffffff));
21 backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode);
22 backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode);
22 m_chartBackgroundGradient = backgroundGradient;
23 m_chartBackgroundGradient = backgroundGradient;
23
24
24 // Axes and other
25 // Axes and other
25 m_axisLinePen = QPen(QRgb(0x0f0f0f));
26 m_titleBrush = QBrush(QRgb(0x181818));
27 m_axisLinePen = QPen(QRgb(0x8c8c8c));
26 m_axisLinePen.setWidth(2);
28 m_axisLinePen.setWidth(2);
27 m_axisLabelBrush = QBrush(QRgb(0x3f3f3f));
29 m_axisLabelBrush = QBrush(QRgb(0x181818));
28 m_gridLinePen = QPen(QRgb(0x0f0f0f));
30 m_gridLinePen = QPen(QRgb(0x8c8c8c));
29 m_gridLinePen.setWidth(2);
31 m_gridLinePen.setWidth(1);
30 m_backgroundShadesBrush = QBrush(QColor(0xff, 0xad, 0x00, 0x50));
32 m_backgroundShadesBrush = QBrush(QRgb(0xffeecd));
31 m_backgroundShades = BackgroundShadesHorizontal;
33 m_backgroundShades = BackgroundShadesHorizontal;
32 }
34 }
33 };
35 };
@@ -8,5 +8,5 THEMES += \
8 $$PWD/chartthemedark_p.h \
8 $$PWD/chartthemedark_p.h \
9 $$PWD/chartthemebrownsand_p.h \
9 $$PWD/chartthemebrownsand_p.h \
10 $$PWD/chartthemebluencs_p.h \
10 $$PWD/chartthemebluencs_p.h \
11 $$PWD/chartthemeicy_p.h \
11 $$PWD/chartthemehighcontrast_p.h \
12 $$PWD/chartthemescientific_p.h No newline at end of file
12 $$PWD/chartthemeblueicy_p.h
@@ -120,8 +120,8 void MainWidget::initThemeCombo(QGridLayout *grid)
120 chartTheme->addItem("Dark");
120 chartTheme->addItem("Dark");
121 chartTheme->addItem("Brown Sand");
121 chartTheme->addItem("Brown Sand");
122 chartTheme->addItem("Blue NCS");
122 chartTheme->addItem("Blue NCS");
123 chartTheme->addItem("Icy");
123 chartTheme->addItem("High Contrast");
124 chartTheme->addItem("Scientific");
124 chartTheme->addItem("Blue Icy");
125 connect(chartTheme, SIGNAL(currentIndexChanged(int)),
125 connect(chartTheme, SIGNAL(currentIndexChanged(int)),
126 this, SLOT(changeChartTheme(int)));
126 this, SLOT(changeChartTheme(int)));
127 grid->addWidget(new QLabel("Chart theme:"), 8, 0);
127 grid->addWidget(new QLabel("Chart theme:"), 8, 0);
General Comments 0
You need to be logged in to leave comments. Login now