From 339ba14ee2eac6fe0113da0331960e6b98e899c2 2012-03-22 10:32:52 From: Tero Ahola Date: 2012-03-22 10:32:52 Subject: [PATCH] Default theme background, removed extra themes --- diff --git a/demos/chartthemes/main.cpp b/demos/chartthemes/main.cpp index 6739818..142ca26 100644 --- a/demos/chartthemes/main.cpp +++ b/demos/chartthemes/main.cpp @@ -64,9 +64,7 @@ public: m_themeComboBox->addItem("Dark", QChart::ChartThemeDark); m_themeComboBox->addItem("Brown Sand", QChart::ChartThemeBrownSand); m_themeComboBox->addItem("Blue NCS", QChart::ChartThemeBlueNcs); - m_themeComboBox->addItem("Vanilla", QChart::ChartThemeVanilla); m_themeComboBox->addItem("Icy", QChart::ChartThemeIcy); - m_themeComboBox->addItem("Grayscale", QChart::ChartThemeGrayscale); m_themeComboBox->addItem("Scientific", QChart::ChartThemeScientific); connect(m_themeComboBox, SIGNAL(currentIndexChanged(int)), this ,SLOT(updateTheme())); QCheckBox *antialiasCheckBox = new QCheckBox("Anti aliasing"); diff --git a/demos/piechartcustomization/main.cpp b/demos/piechartcustomization/main.cpp index 6ae0d7c..d357378 100644 --- a/demos/piechartcustomization/main.cpp +++ b/demos/piechartcustomization/main.cpp @@ -308,9 +308,7 @@ public: m_themeComboBox->addItem("Dark", QChart::ChartThemeDark); m_themeComboBox->addItem("BrownSand", QChart::ChartThemeBrownSand); m_themeComboBox->addItem("BlueNcs", QChart::ChartThemeBlueNcs); - m_themeComboBox->addItem("Vanilla", QChart::ChartThemeVanilla); m_themeComboBox->addItem("Icy", QChart::ChartThemeIcy); - m_themeComboBox->addItem("Grayscale", QChart::ChartThemeGrayscale); m_themeComboBox->addItem("Scientific", QChart::ChartThemeScientific); m_aaCheckBox = new QCheckBox(); diff --git a/examples/piechartdrilldown/main.cpp b/examples/piechartdrilldown/main.cpp index 03347a1..7ad14d8 100644 --- a/examples/piechartdrilldown/main.cpp +++ b/examples/piechartdrilldown/main.cpp @@ -77,7 +77,7 @@ int main(int argc, char *argv[]) DrilldownChart* drilldownChart = new DrilldownChart(&window); drilldownChart->setRenderHint(QPainter::Antialiasing); - drilldownChart->setChartTheme(QChart::ChartThemeVanilla); + drilldownChart->setChartTheme(QChart::ChartThemeLight); drilldownChart->setAnimationOptions(QChart::AllAnimations); QPieSeries* yearSeries = new QPieSeries(&window); diff --git a/qmlplugin/declarativechart.h b/qmlplugin/declarativechart.h index e4b19f1..d558a9f 100644 --- a/qmlplugin/declarativechart.h +++ b/qmlplugin/declarativechart.h @@ -23,9 +23,7 @@ public: ThemeDark, ThemeBrownSand, ThemeBlueNcs, - ThemeVanilla, ThemeIcy, - ThemeGrayscale, ThemeScientific }; DeclarativeChart(QDeclarativeItem *parent = 0); diff --git a/src/charttheme.cpp b/src/charttheme.cpp index ba4224b..a17e04b 100644 --- a/src/charttheme.cpp +++ b/src/charttheme.cpp @@ -35,9 +35,7 @@ #include "chartthemedark_p.h" #include "chartthemebrownsand_p.h" #include "chartthemebluencs_p.h" -#include "chartthemevanilla_p.h" #include "chartthemeicy_p.h" -#include "chartthemegrayscale_p.h" #include "chartthemescientific_p.h" QTCOMMERCIALCHART_BEGIN_NAMESPACE @@ -70,12 +68,8 @@ ChartTheme* ChartTheme::createTheme(QChart::ChartTheme theme) return new ChartThemeBrownSand(); case QChart::ChartThemeBlueNcs: return new ChartThemeBlueNcs(); - case QChart::ChartThemeVanilla: - return new ChartThemeVanilla(); case QChart::ChartThemeIcy: return new ChartThemeIcy(); - case QChart::ChartThemeGrayscale: - return new ChartThemeGrayscale(); case QChart::ChartThemeScientific: return new ChartThemeScientific(); default: diff --git a/src/qchart.cpp b/src/qchart.cpp index 317ab0a..e7800d6 100644 --- a/src/qchart.cpp +++ b/src/qchart.cpp @@ -16,12 +16,13 @@ QTCOMMERCIALCHART_BEGIN_NAMESPACE This enum describes the theme used by the chart. \value ChartThemeDefault Follows the GUI style of the Operating System - \value ChartThemeVanilla + \value ChartThemeLight + \value ChartThemeBlueCerulean + \value ChartThemeDark + \value ChartThemeBrownSand + \value ChartThemeBlueNcs \value ChartThemeIcy - \value ChartThemeGrayscale \value ChartThemeScientific - \value ChartThemeBlueCerulean - \value ChartThemeLight \value ChartThemeCount Not really a theme; the total count of themes. */ diff --git a/src/qchart.h b/src/qchart.h index 963a699..a880eb3 100644 --- a/src/qchart.h +++ b/src/qchart.h @@ -35,9 +35,7 @@ public: ChartThemeDark, ChartThemeBrownSand, ChartThemeBlueNcs, - ChartThemeVanilla, ChartThemeIcy, - ChartThemeGrayscale, ChartThemeScientific, ChartThemeCount }; diff --git a/src/src.pro b/src/src.pro index bd8927d..bf6291e 100644 --- a/src/src.pro +++ b/src/src.pro @@ -52,9 +52,7 @@ THEMES += themes/chartthemedefault_p.h \ themes/chartthemebrownsand_p.h \ themes/chartthemebluencs_p.h \ themes/chartthemeicy_p.h \ - themes/chartthemegrayscale_p.h \ - themes/chartthemescientific_p.h \ - themes/chartthemevanilla_p.h + themes/chartthemescientific_p.h HEADERS += $$PUBLIC_HEADERS HEADERS += $$PRIVATE_HEADERS diff --git a/src/themes/chartthemebluecerulean_p.h b/src/themes/chartthemebluecerulean_p.h index c7cad39..926404f 100644 --- a/src/themes/chartthemebluecerulean_p.h +++ b/src/themes/chartthemebluecerulean_p.h @@ -30,6 +30,7 @@ public: m_axisLabelBrush = QBrush(QRgb(0xffffff)); m_gridLinePen = QPen(QRgb(0x84a2b0)); m_gridLinePen.setWidth(1); + m_backgroundShades = BackgroundShadesNone; } }; diff --git a/src/themes/chartthemebluencs_p.h b/src/themes/chartthemebluencs_p.h index 76c0132..d3a386e 100644 --- a/src/themes/chartthemebluencs_p.h +++ b/src/themes/chartthemebluencs_p.h @@ -30,6 +30,7 @@ public: m_axisLabelBrush = QBrush(QRgb(0x404044)); m_gridLinePen = QPen(QRgb(0xe2e2e2)); m_gridLinePen.setWidth(1); + m_backgroundShades = BackgroundShadesNone; } }; diff --git a/src/themes/chartthemebrownsand_p.h b/src/themes/chartthemebrownsand_p.h index 91e1f16..806c296 100644 --- a/src/themes/chartthemebrownsand_p.h +++ b/src/themes/chartthemebrownsand_p.h @@ -30,6 +30,7 @@ public: m_axisLabelBrush = QBrush(QRgb(0x404044)); m_gridLinePen = QPen(QRgb(0xd4cec3)); m_gridLinePen.setWidth(1); + m_backgroundShades = BackgroundShadesNone; } }; diff --git a/src/themes/chartthemedark_p.h b/src/themes/chartthemedark_p.h index 7919a4d..b62d5ac 100644 --- a/src/themes/chartthemedark_p.h +++ b/src/themes/chartthemedark_p.h @@ -30,6 +30,7 @@ public: m_axisLabelBrush = QBrush(QRgb(0xffffff)); m_gridLinePen = QPen(QRgb(0x86878c)); m_gridLinePen.setWidth(1); + m_backgroundShades = BackgroundShadesNone; } }; diff --git a/src/themes/chartthemedefault_p.h b/src/themes/chartthemedefault_p.h index 329b30a..b7bbbe4 100644 --- a/src/themes/chartthemedefault_p.h +++ b/src/themes/chartthemedefault_p.h @@ -63,8 +63,13 @@ public: GetGValue(colorWindow), GetBValue(colorWindow))); // Axes and other - m_backgroundShadesBrush = QBrush(QColor(0xaf, 0xaf, 0xaf, 0x50)); - m_backgroundShades = BackgroundShadesVertical; + m_masterFont = QFont("arial"); + m_axisLinePen = QPen(0xd6d6d6); + m_axisLinePen.setWidth(1); + m_axisLabelBrush = QBrush(QRgb(0x404044)); + m_gridLinePen = QPen(QRgb(0xe2e2e2)); + m_gridLinePen.setWidth(1); + m_backgroundShades = BackgroundShadesNone; #elif defined(Q_OS_LINUX) // TODO: replace this dummy theme with linux specific theme @@ -74,15 +79,21 @@ public: m_seriesColors << QRgb(0xfc5751); generateSeriesGradients(); + // Background QLinearGradient backgroundGradient; backgroundGradient.setColorAt(0.0, QRgb(0xffffff)); - backgroundGradient.setColorAt(1.0, QRgb(0xe9e9e9)); + backgroundGradient.setColorAt(1.0, QRgb(0xffffff)); backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode); m_chartBackgroundGradient = backgroundGradient; // Axes and other - m_backgroundShadesBrush = QBrush(QColor(0xaf, 0xaf, 0xaf, 0x50)); - m_backgroundShades = BackgroundShadesVertical; + m_masterFont = QFont("arial"); + m_axisLinePen = QPen(0xd6d6d6); + m_axisLinePen.setWidth(1); + m_axisLabelBrush = QBrush(QRgb(0x404044)); + m_gridLinePen = QPen(QRgb(0xe2e2e2)); + m_gridLinePen.setWidth(1); + m_backgroundShades = BackgroundShadesNone; #elif defined(Q_OS_MAC) // TODO: replace this dummy theme with OSX specific theme @@ -92,15 +103,21 @@ public: m_seriesColors << QRgb(0xfc5751); generateSeriesGradients(); + // Background QLinearGradient backgroundGradient; backgroundGradient.setColorAt(0.0, QRgb(0xffffff)); - backgroundGradient.setColorAt(1.0, QRgb(0xe9e9e9)); + backgroundGradient.setColorAt(1.0, QRgb(0xffffff)); backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode); m_chartBackgroundGradient = backgroundGradient; // Axes and other - m_backgroundShadesBrush = QBrush(QColor(0xaf, 0xaf, 0xaf, 0x50)); - m_backgroundShades = BackgroundShadesVertical; + m_masterFont = QFont("arial"); + m_axisLinePen = QPen(0xd6d6d6); + m_axisLinePen.setWidth(1); + m_axisLabelBrush = QBrush(QRgb(0x404044)); + m_gridLinePen = QPen(QRgb(0xe2e2e2)); + m_gridLinePen.setWidth(1); + m_backgroundShades = BackgroundShadesNone; #else // TODO: replace this dummy theme with generic (not OS specific) theme @@ -110,15 +127,21 @@ public: m_seriesColors << QRgb(0xfc5751); generateSeriesGradients(); + // Background QLinearGradient backgroundGradient; backgroundGradient.setColorAt(0.0, QRgb(0xffffff)); - backgroundGradient.setColorAt(1.0, QRgb(0xafafaf)); + backgroundGradient.setColorAt(1.0, QRgb(0xffffff)); backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode); - m_backgroundGradient = backgroundGradient; + m_chartBackgroundGradient = backgroundGradient; // Axes and other - m_backgroundShadesBrush = QBrush(QColor(0xaf, 0xaf, 0xaf, 0x50)); - m_backgroundShades = BackgroundShadesVertical; + m_masterFont = QFont("arial"); + m_axisLinePen = QPen(0xd6d6d6); + m_axisLinePen.setWidth(1); + m_axisLabelBrush = QBrush(QRgb(0x404044)); + m_gridLinePen = QPen(QRgb(0xe2e2e2)); + m_gridLinePen.setWidth(1); + m_backgroundShades = BackgroundShadesNone; #endif } }; diff --git a/src/themes/chartthemegrayscale_p.h b/src/themes/chartthemegrayscale_p.h deleted file mode 100644 index 09148a7..0000000 --- a/src/themes/chartthemegrayscale_p.h +++ /dev/null @@ -1,33 +0,0 @@ -#include "charttheme_p.h" - -QTCOMMERCIALCHART_BEGIN_NAMESPACE - -class ChartThemeGrayscale: public ChartTheme -{ -public: - ChartThemeGrayscale() : ChartTheme(QChart::ChartThemeGrayscale) - { - // Series colors - m_seriesColors << QRgb(0x869299); - m_seriesColors << QRgb(0xa5bdcc); - m_seriesColors << QRgb(0xe8fffc); - m_seriesColors << QRgb(0xccc2c2); - generateSeriesGradients(); - - // Background - QLinearGradient backgroundGradient; - backgroundGradient.setColorAt(0.0, QRgb(0xffffff)); - backgroundGradient.setColorAt(1.0, QRgb(0xe0e3e5)); - backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode); - m_chartBackgroundGradient = backgroundGradient; - - // Axes and other - m_axisLinePen = QPen(QRgb(0x0f0f0f)); - m_axisLinePen.setWidth(2); - m_axisLabelBrush = QBrush(QRgb(0x3f3f3f)); - m_gridLinePen = QPen(QRgb(0x0f0f0f)); - m_gridLinePen.setWidth(2); - } -}; - -QTCOMMERCIALCHART_END_NAMESPACE diff --git a/src/themes/chartthemeicy_p.h b/src/themes/chartthemeicy_p.h index 1e39fc3..b36127a 100644 --- a/src/themes/chartthemeicy_p.h +++ b/src/themes/chartthemeicy_p.h @@ -27,6 +27,7 @@ public: m_axisLabelBrush = QBrush(QRgb(0x3f3f3f)); m_gridLinePen = QPen(QRgb(0x0f0f0f)); m_gridLinePen.setWidth(2); + m_backgroundShades = BackgroundShadesNone; } }; diff --git a/src/themes/chartthemelight_p.h b/src/themes/chartthemelight_p.h index 7d949f4..7e600de 100644 --- a/src/themes/chartthemelight_p.h +++ b/src/themes/chartthemelight_p.h @@ -29,6 +29,7 @@ public: m_axisLabelBrush = QBrush(QRgb(0x404044)); m_gridLinePen = QPen(QRgb(0xe2e2e2)); m_gridLinePen.setWidth(1); + m_backgroundShades = BackgroundShadesNone; } }; diff --git a/src/themes/chartthemescientific_p.h b/src/themes/chartthemescientific_p.h index 1b0e5bf..d52f166 100644 --- a/src/themes/chartthemescientific_p.h +++ b/src/themes/chartthemescientific_p.h @@ -25,10 +25,10 @@ public: m_axisLinePen = QPen(QRgb(0x0f0f0f)); m_axisLinePen.setWidth(2); m_axisLabelBrush = QBrush(QRgb(0x3f3f3f)); - m_backgroundShadesBrush = QBrush(QColor(0xff, 0xad, 0x00, 0x50)); - m_backgroundShades = BackgroundShadesHorizontal; m_gridLinePen = QPen(QRgb(0x0f0f0f)); m_gridLinePen.setWidth(2); + m_backgroundShadesBrush = QBrush(QColor(0xff, 0xad, 0x00, 0x50)); + m_backgroundShades = BackgroundShadesHorizontal; } }; diff --git a/src/themes/chartthemevanilla_p.h b/src/themes/chartthemevanilla_p.h deleted file mode 100644 index 7c79091..0000000 --- a/src/themes/chartthemevanilla_p.h +++ /dev/null @@ -1,34 +0,0 @@ -#include "charttheme_p.h" - -QTCOMMERCIALCHART_BEGIN_NAMESPACE - -class ChartThemeVanilla: public ChartTheme -{ -public: - ChartThemeVanilla() : ChartTheme(QChart::ChartThemeVanilla) - { - // Series - m_seriesColors << QRgb(0xd9c574); - m_seriesColors << QRgb(0xd6a896); - m_seriesColors << QRgb(0xa0a071); - m_seriesColors << QRgb(0xd2d234); - m_seriesColors << QRgb(0x88723a); - generateSeriesGradients(); - - // Background - QLinearGradient backgroundGradient; - backgroundGradient.setColorAt(0.0, QRgb(0xfbf9f1)); - backgroundGradient.setColorAt(1.0, QRgb(0xf5f0dc)); - backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode); - m_chartBackgroundGradient = backgroundGradient; - - // Axes and other - m_axisLinePen = QPen(QRgb(0x0f0f0f)); - m_axisLinePen.setWidth(2); - m_axisLabelBrush = QBrush(QRgb(0xa0a071)); - m_gridLinePen = QPen(QRgb(0x0f0f0f)); - m_gridLinePen.setWidth(2); - } -}; - -QTCOMMERCIALCHART_END_NAMESPACE diff --git a/test/chartwidgettest/mainwidget.cpp b/test/chartwidgettest/mainwidget.cpp index 3162229..04ca0e5 100644 --- a/test/chartwidgettest/mainwidget.cpp +++ b/test/chartwidgettest/mainwidget.cpp @@ -115,11 +115,13 @@ void MainWidget::initThemeCombo(QGridLayout *grid) { QComboBox *chartTheme = new QComboBox(); chartTheme->addItem("Default"); - chartTheme->addItem("Vanilla"); + chartTheme->addItem("Light"); + chartTheme->addItem("Blue Cerulean"); + chartTheme->addItem("Dark"); + chartTheme->addItem("Brown Sand"); + chartTheme->addItem("Blue NCS"); chartTheme->addItem("Icy"); - chartTheme->addItem("Grayscale"); chartTheme->addItem("Scientific"); - chartTheme->addItem("Unnamed1"); connect(chartTheme, SIGNAL(currentIndexChanged(int)), this, SLOT(changeChartTheme(int))); grid->addWidget(new QLabel("Chart theme:"), 8, 0);