##// END OF EJS Templates
Add new Qt theme template...
Titta Heikkala -
r2625:3dc2625e2a47
parent child
Show More
@@ -0,0 +1,74
1 /****************************************************************************
2 **
3 ** Copyright (C) 2013 Digia Plc
4 ** All rights reserved.
5 ** For any questions to Digia, please use contact form at http://qt.digia.com
6 **
7 ** This file is part of the Qt Enterprise Charts Add-on.
8 **
9 ** $QT_BEGIN_LICENSE$
10 ** Licensees holding valid Qt Enterprise licenses may use this file in
11 ** accordance with the Qt Enterprise License Agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia.
14 **
15 ** If you have questions regarding the use of this file, please use
16 ** contact form at http://qt.digia.com
17 ** $QT_END_LICENSE$
18 **
19 ****************************************************************************/
20
21 // W A R N I N G
22 // -------------
23 //
24 // This file is not part of the Qt Enterprise Chart API. It exists purely as an
25 // implementation detail. This header file may change from version to
26 // version without notice, or even be removed.
27 //
28 // We mean it.
29
30 #ifndef CHARTTHEMEQT_P_H
31 #define CHARTTHEMEQT_P_H
32
33 #include "charttheme_p.h"
34
35 QTCOMMERCIALCHART_BEGIN_NAMESPACE
36
37 class ChartThemeQt : public ChartTheme
38 {
39 public:
40 ChartThemeQt() : ChartTheme(QChart::ChartThemeQt)
41 {
42 // Series colors
43 m_seriesColors << QRgb(0x80c342);
44 m_seriesColors << QRgb(0x328930);
45 m_seriesColors << QRgb(0x006325);
46 m_seriesColors << QRgb(0x35322f);
47 m_seriesColors << QRgb(0x5d5b59);
48 m_seriesColors << QRgb(0x868482);
49 m_seriesColors << QRgb(0xaeadac);
50 m_seriesColors << QRgb(0xd7d6d5);
51 m_seriesGradients = ChartThemeManager::generateSeriesGradients(m_seriesColors);
52
53 // Background
54 QLinearGradient backgroundGradient(0.5, 0.0, 0.5, 1.0);
55 backgroundGradient.setColorAt(0.0, QRgb(0xffffff));
56 backgroundGradient.setColorAt(1.0, QRgb(0xffffff));
57 backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode);
58 m_chartBackgroundGradient = backgroundGradient;
59
60 // Axes and other
61 m_labelBrush = QBrush(QRgb(0x35322f));
62 m_axisLinePen = QPen(QRgb(0xd7d6d5));
63 m_axisLinePen.setWidth(1);
64 m_gridLinePen = QPen(QRgb(0xd7d6d5));
65 m_gridLinePen.setWidth(1);
66 m_backgroundShades = BackgroundShadesNone;
67 m_outlinePen = QPen(QRgb(0x35322f));
68 m_outlinePen.setWidthF(2.0);
69 }
70 };
71
72 QTCOMMERCIALCHART_END_NAMESPACE
73
74 #endif
@@ -151,6 +151,7 QComboBox *ThemeWidget::createThemeBox() const
151 themeComboBox->addItem("Blue NCS", QChart::ChartThemeBlueNcs);
151 themeComboBox->addItem("Blue NCS", QChart::ChartThemeBlueNcs);
152 themeComboBox->addItem("High Contrast", QChart::ChartThemeHighContrast);
152 themeComboBox->addItem("High Contrast", QChart::ChartThemeHighContrast);
153 themeComboBox->addItem("Blue Icy", QChart::ChartThemeBlueIcy);
153 themeComboBox->addItem("Blue Icy", QChart::ChartThemeBlueIcy);
154 themeComboBox->addItem("Qt", QChart::ChartThemeQt);
154 return themeComboBox;
155 return themeComboBox;
155 }
156 }
156
157
@@ -80,7 +80,8 public:
80 ChartThemeBrownSand,
80 ChartThemeBrownSand,
81 ChartThemeBlueNcs,
81 ChartThemeBlueNcs,
82 ChartThemeHighContrast,
82 ChartThemeHighContrast,
83 ChartThemeBlueIcy
83 ChartThemeBlueIcy,
84 ChartThemeQt
84 };
85 };
85
86
86 enum Animation {
87 enum Animation {
@@ -29,6 +29,7
29 #include "chartthemebluencs_p.h"
29 #include "chartthemebluencs_p.h"
30 #include "chartthemehighcontrast_p.h"
30 #include "chartthemehighcontrast_p.h"
31 #include "chartthemeblueicy_p.h"
31 #include "chartthemeblueicy_p.h"
32 #include "chartthemeqt_p.h"
32
33
33 QTCOMMERCIALCHART_BEGIN_NAMESPACE
34 QTCOMMERCIALCHART_BEGIN_NAMESPACE
34
35
@@ -64,6 +65,9 void ChartThemeManager::setTheme(QChart::ChartTheme theme)
64 case QChart::ChartThemeBlueIcy:
65 case QChart::ChartThemeBlueIcy:
65 m_theme.reset(new ChartThemeBlueIcy());
66 m_theme.reset(new ChartThemeBlueIcy());
66 break;
67 break;
68 case QChart::ChartThemeQt:
69 m_theme.reset(new ChartThemeQt());
70 break;
67 default:
71 default:
68 m_theme.reset(new ChartThemeSystem());
72 m_theme.reset(new ChartThemeSystem());
69 break;
73 break;
@@ -67,7 +67,8 public:
67 ChartThemeBrownSand,
67 ChartThemeBrownSand,
68 ChartThemeBlueNcs,
68 ChartThemeBlueNcs,
69 ChartThemeHighContrast,
69 ChartThemeHighContrast,
70 ChartThemeBlueIcy
70 ChartThemeBlueIcy,
71 ChartThemeQt
71 };
72 };
72
73
73 enum AnimationOption {
74 enum AnimationOption {
@@ -10,4 +10,5 THEMES += \
10 $$PWD/chartthemebrownsand_p.h \
10 $$PWD/chartthemebrownsand_p.h \
11 $$PWD/chartthemebluencs_p.h \
11 $$PWD/chartthemebluencs_p.h \
12 $$PWD/chartthemehighcontrast_p.h \
12 $$PWD/chartthemehighcontrast_p.h \
13 $$PWD/chartthemeblueicy_p.h
13 $$PWD/chartthemeblueicy_p.h \
14 $$PWD/chartthemeqt_p.h
@@ -719,6 +719,7 void tst_QChart::theme_data()
719 QTest::newRow("ChartThemeDark") << QChart::ChartThemeDark;
719 QTest::newRow("ChartThemeDark") << QChart::ChartThemeDark;
720 QTest::newRow("hartThemeHighContrast") << QChart::ChartThemeHighContrast;
720 QTest::newRow("hartThemeHighContrast") << QChart::ChartThemeHighContrast;
721 QTest::newRow("ChartThemeLight") << QChart::ChartThemeLight;
721 QTest::newRow("ChartThemeLight") << QChart::ChartThemeLight;
722 QTest::newRow("ChartThemeQt") << QChart::ChartThemeQt;
722 }
723 }
723
724
724 void tst_QChart::theme()
725 void tst_QChart::theme()
@@ -163,6 +163,7 QComboBox *Window::createThemeBox()
163 themeComboBox->addItem("Blue NCS", QChart::ChartThemeBlueNcs);
163 themeComboBox->addItem("Blue NCS", QChart::ChartThemeBlueNcs);
164 themeComboBox->addItem("High Contrast", QChart::ChartThemeHighContrast);
164 themeComboBox->addItem("High Contrast", QChart::ChartThemeHighContrast);
165 themeComboBox->addItem("Blue Icy", QChart::ChartThemeBlueIcy);
165 themeComboBox->addItem("Blue Icy", QChart::ChartThemeBlueIcy);
166 themeComboBox->addItem("Qt", QChart::ChartThemeQt);
166 return themeComboBox;
167 return themeComboBox;
167 }
168 }
168
169
@@ -410,6 +411,9 void Window::checkTheme()
410 } else if (theme == QChart::ChartThemeBlueIcy) {
411 } else if (theme == QChart::ChartThemeBlueIcy) {
411 pal.setColor(QPalette::Window, QRgb(0xcee7f0));
412 pal.setColor(QPalette::Window, QRgb(0xcee7f0));
412 pal.setColor(QPalette::WindowText, QRgb(0x404044));
413 pal.setColor(QPalette::WindowText, QRgb(0x404044));
414 } else if (theme == QChart::ChartThemeQt) {
415 pal.setColor(QPalette::Window, QRgb(0xf0f0f0));
416 pal.setColor(QPalette::WindowText, QRgb(0x404044));
413 } else {
417 } else {
414 pal.setColor(QPalette::Window, QRgb(0xf0f0f0));
418 pal.setColor(QPalette::Window, QRgb(0xf0f0f0));
415 pal.setColor(QPalette::WindowText, QRgb(0x404044));
419 pal.setColor(QPalette::WindowText, QRgb(0x404044));
General Comments 0
You need to be logged in to leave comments. Login now