@@ -0,0 +1,36 | |||||
|
1 | #include "charttheme_p.h" | |||
|
2 | ||||
|
3 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |||
|
4 | ||||
|
5 | class ChartThemeBlueCerulean: public ChartTheme | |||
|
6 | { | |||
|
7 | public: | |||
|
8 | ChartThemeBlueCerulean() : ChartTheme(QChart::ChartThemeBlueCerulean) | |||
|
9 | { | |||
|
10 | // Series colors | |||
|
11 | m_seriesColors << QRgb(0xc7e85b); | |||
|
12 | m_seriesColors << QRgb(0x5dbe9b); | |||
|
13 | m_seriesColors << QRgb(0x4fbef3); | |||
|
14 | generateSeriesGradients(); | |||
|
15 | ||||
|
16 | // Background | |||
|
17 | QLinearGradient backgroundGradient; | |||
|
18 | backgroundGradient.setColorAt(0.0, QRgb(0x056188)); | |||
|
19 | backgroundGradient.setColorAt(1.0, QRgb(0x101a33)); | |||
|
20 | backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode); | |||
|
21 | m_backgroundGradient = backgroundGradient; | |||
|
22 | ||||
|
23 | // Axes and other | |||
|
24 | m_masterFont = QFont(); | |||
|
25 | m_axisLinePen = QPen(QRgb(0x0f0f0f)); | |||
|
26 | m_axisLinePen.setWidth(2); | |||
|
27 | m_axisLabelBrush = QBrush(QRgb(0x3f3f3f)); | |||
|
28 | m_axisLabelPen = Qt::NoPen; // NoPen for performance reasons | |||
|
29 | m_backgroundShadesPen = Qt::NoPen; | |||
|
30 | m_backgroundShades = BackgroundShadesNone; | |||
|
31 | m_gridLinePen = QPen(QRgb(0x0f0f0f)); | |||
|
32 | m_gridLinePen.setWidth(2); | |||
|
33 | } | |||
|
34 | }; | |||
|
35 | ||||
|
36 | QTCOMMERCIALCHART_END_NAMESPACE |
@@ -61,6 +61,7 public: | |||||
61 | m_themeComboBox->addItem("Icy", QChart::ChartThemeIcy); |
|
61 | m_themeComboBox->addItem("Icy", QChart::ChartThemeIcy); | |
62 | m_themeComboBox->addItem("Grayscale", QChart::ChartThemeGrayscale); |
|
62 | m_themeComboBox->addItem("Grayscale", QChart::ChartThemeGrayscale); | |
63 | m_themeComboBox->addItem("Scientific", QChart::ChartThemeScientific); |
|
63 | m_themeComboBox->addItem("Scientific", QChart::ChartThemeScientific); | |
|
64 | m_themeComboBox->addItem("Blue Cerulean", QChart::ChartThemeBlueCerulean); | |||
64 | connect(m_themeComboBox, SIGNAL(currentIndexChanged(int)), this ,SLOT(updateTheme())); |
|
65 | connect(m_themeComboBox, SIGNAL(currentIndexChanged(int)), this ,SLOT(updateTheme())); | |
65 | baseLayout->addWidget(new QLabel("Theme:"), 0, 0); |
|
66 | baseLayout->addWidget(new QLabel("Theme:"), 0, 0); | |
66 | baseLayout->addWidget(m_themeComboBox, 0, 1); |
|
67 | baseLayout->addWidget(m_themeComboBox, 0, 1); |
@@ -33,6 +33,7 | |||||
33 | #include "chartthemeicy_p.h" |
|
33 | #include "chartthemeicy_p.h" | |
34 | #include "chartthemegrayscale_p.h" |
|
34 | #include "chartthemegrayscale_p.h" | |
35 | #include "chartthemescientific_p.h" |
|
35 | #include "chartthemescientific_p.h" | |
|
36 | #include "chartthemebluecerulean_p.h" | |||
36 |
|
37 | |||
37 |
|
38 | |||
38 | QTCOMMERCIALCHART_BEGIN_NAMESPACE |
|
39 | QTCOMMERCIALCHART_BEGIN_NAMESPACE | |
@@ -55,6 +56,8 ChartTheme* ChartTheme::createTheme(QChart::ChartTheme theme) | |||||
55 | return new ChartThemeGrayscale(); |
|
56 | return new ChartThemeGrayscale(); | |
56 | case QChart::ChartThemeScientific: |
|
57 | case QChart::ChartThemeScientific: | |
57 | return new ChartThemeScientific(); |
|
58 | return new ChartThemeScientific(); | |
|
59 | case QChart::ChartThemeBlueCerulean: | |||
|
60 | return new ChartThemeBlueCerulean(); | |||
58 | default: |
|
61 | default: | |
59 | return new ChartThemeDefault(); |
|
62 | return new ChartThemeDefault(); | |
60 | } |
|
63 | } | |
@@ -62,7 +65,10 ChartTheme* ChartTheme::createTheme(QChart::ChartTheme theme) | |||||
62 |
|
65 | |||
63 | void ChartTheme::decorate(QChart* chart) |
|
66 | void ChartTheme::decorate(QChart* chart) | |
64 | { |
|
67 | { | |
65 | chart->setChartBackgroundBrush(m_backgroundGradient); |
|
68 | if (m_backgroundShades == BackgroundShadesNone) | |
|
69 | chart->setChartBackgroundBrush(m_backgroundGradient); | |||
|
70 | else | |||
|
71 | chart->setChartBackgroundBrush(Qt::NoBrush); | |||
66 | chart->setChartTitleFont(m_masterFont); |
|
72 | chart->setChartTitleFont(m_masterFont); | |
67 | } |
|
73 | } | |
68 |
|
74 |
@@ -14,11 +14,13 QTCOMMERCIALCHART_BEGIN_NAMESPACE | |||||
14 |
|
14 | |||
15 | This enum describes the theme used by the chart. |
|
15 | This enum describes the theme used by the chart. | |
16 |
|
16 | |||
17 | \value ChartThemeDefault |
|
17 | \value ChartThemeDefault Follows the GUI style of the Operating System | |
18 | \value ChartThemeVanilla |
|
18 | \value ChartThemeVanilla | |
19 | \value ChartThemeIcy |
|
19 | \value ChartThemeIcy | |
20 | \value ChartThemeGrayscale |
|
20 | \value ChartThemeGrayscale | |
21 | \value ChartThemeScientific |
|
21 | \value ChartThemeScientific | |
|
22 | \value ChartThemeBlueCerulean | |||
|
23 | \value ChartThemeCount Not really a theme; the total count of themes. | |||
22 | */ |
|
24 | */ | |
23 |
|
25 | |||
24 | /*! |
|
26 | /*! |
@@ -31,9 +31,9 public: | |||||
31 | ChartThemeVanilla, |
|
31 | ChartThemeVanilla, | |
32 | ChartThemeIcy, |
|
32 | ChartThemeIcy, | |
33 | ChartThemeGrayscale, |
|
33 | ChartThemeGrayscale, | |
34 | ChartThemeScientific |
|
34 | ChartThemeScientific, | |
35 |
|
|
35 | ChartThemeBlueCerulean, | |
36 | /*! The default theme follows the GUI style of the Operating System */ |
|
36 | ChartThemeCount | |
37 | }; |
|
37 | }; | |
38 |
|
38 | |||
39 | enum AnimationOption { |
|
39 | enum AnimationOption { |
@@ -44,7 +44,8 THEMES += themes/chartthemedefault_p.h \ | |||||
44 | themes/chartthemeicy_p.h \ |
|
44 | themes/chartthemeicy_p.h \ | |
45 | themes/chartthemegrayscale_p.h \ |
|
45 | themes/chartthemegrayscale_p.h \ | |
46 | themes/chartthemescientific_p.h \ |
|
46 | themes/chartthemescientific_p.h \ | |
47 | themes/chartthemevanilla_p.h |
|
47 | themes/chartthemevanilla_p.h \ | |
|
48 | themes/chartthemebluecerulean_p.h | |||
48 | HEADERS += $$PUBLIC_HEADERS |
|
49 | HEADERS += $$PUBLIC_HEADERS | |
49 | HEADERS += $$PRIVATE_HEADERS |
|
50 | HEADERS += $$PRIVATE_HEADERS | |
50 | HEADERS += $$THEMES |
|
51 | HEADERS += $$THEMES |
General Comments 0
You need to be logged in to leave comments.
Login now