From 9dc445f7b1fbaabd4e1b07ad2dea969afdb789db 2012-04-03 13:55:41 From: Tero Ahola Date: 2012-04-03 13:55:41 Subject: [PATCH] Removed default theme, now using light as the default --- diff --git a/demos/chartthemes/themewidget.cpp b/demos/chartthemes/themewidget.cpp index 3fb54d2..bc3a68e 100644 --- a/demos/chartthemes/themewidget.cpp +++ b/demos/chartthemes/themewidget.cpp @@ -48,10 +48,9 @@ ThemeWidget::ThemeWidget(QWidget* parent) : m_valueCount(7), m_dataTable(generateRandomData(m_listCount,m_valueMax,m_valueCount)), m_themeComboBox(createThemeBox()), - m_antialiasCheckBox(new QCheckBox("Anti aliasing")), + m_antialiasCheckBox(new QCheckBox("Anti-aliasing")), m_animatedComboBox(createAnimationBox()), m_legendComboBox(createLegendBox()) - { connectSignals(); // create layout @@ -141,7 +140,6 @@ QComboBox* ThemeWidget::createThemeBox() const { // settings layout QComboBox* themeComboBox = new QComboBox(); - themeComboBox->addItem("Default", QChart::ChartThemeDefault); themeComboBox->addItem("Light", QChart::ChartThemeLight); themeComboBox->addItem("Blue Cerulean", QChart::ChartThemeBlueCerulean); themeComboBox->addItem("Dark", QChart::ChartThemeDark); diff --git a/demos/piechartcustomization/mainwidget.cpp b/demos/piechartcustomization/mainwidget.cpp index 06b1418..6994c6d 100644 --- a/demos/piechartcustomization/mainwidget.cpp +++ b/demos/piechartcustomization/mainwidget.cpp @@ -57,7 +57,6 @@ MainWidget::MainWidget(QWidget* parent) // chart settings m_themeComboBox = new QComboBox(); - m_themeComboBox->addItem("Default", QChart::ChartThemeDefault); m_themeComboBox->addItem("Light", QChart::ChartThemeLight); m_themeComboBox->addItem("BlueCerulean", QChart::ChartThemeBlueCerulean); m_themeComboBox->addItem("Dark", QChart::ChartThemeDark); diff --git a/src/chartpresenter.cpp b/src/chartpresenter.cpp index 56759b4..d1f4314 100644 --- a/src/chartpresenter.cpp +++ b/src/chartpresenter.cpp @@ -57,7 +57,7 @@ ChartPresenter::ChartPresenter(QChart* chart,ChartDataSet* dataset):QObject(char m_backgroundPadding(10) { createConnections(); - setTheme(QChart::ChartThemeDefault,false); + setTheme(QChart::ChartThemeLight, false); } ChartPresenter::~ChartPresenter() diff --git a/src/charttheme.cpp b/src/charttheme.cpp index 74f5626..b76d1ab 100644 --- a/src/charttheme.cpp +++ b/src/charttheme.cpp @@ -49,7 +49,7 @@ #include "splinechartitem_p.h" //themes -#include "chartthemedefault_p.h" +#include "chartthemesystem_p.h" #include "chartthemelight_p.h" #include "chartthemebluecerulean_p.h" #include "chartthemedark_p.h" @@ -61,7 +61,7 @@ QTCOMMERCIALCHART_BEGIN_NAMESPACE ChartTheme::ChartTheme(QChart::ChartTheme id) : - m_masterFont(QFont("arial", 12)), + m_masterFont(QFont("arial", 14)), m_labelFont(QFont("arial", 10)), m_titleBrush(QColor(QRgb(0x000000))), m_axisLinePen(QPen(QRgb(0x000000))), @@ -94,7 +94,7 @@ ChartTheme* ChartTheme::createTheme(QChart::ChartTheme theme) case QChart::ChartThemeBlueIcy: return new ChartThemeBlueIcy(); default: - return new ChartThemeDefault(); + return new ChartThemeSystem(); } } diff --git a/src/charttheme_p.h b/src/charttheme_p.h index 66f44fe..b25890e 100644 --- a/src/charttheme_p.h +++ b/src/charttheme_p.h @@ -58,7 +58,7 @@ public: }; protected: - explicit ChartTheme(QChart::ChartTheme id = QChart::ChartThemeDefault); + explicit ChartTheme(QChart::ChartTheme id = QChart::ChartThemeLight); public: static ChartTheme* createTheme(QChart::ChartTheme theme); QChart::ChartTheme id() const {return m_id;} diff --git a/src/qchart.cpp b/src/qchart.cpp index ffd5834..86b7bcf 100644 --- a/src/qchart.cpp +++ b/src/qchart.cpp @@ -30,8 +30,7 @@ QTCOMMERCIALCHART_BEGIN_NAMESPACE This enum describes the theme used by the chart. - \value ChartThemeDefault Follows the GUI style of the Operating System - \value ChartThemeLight + \value ChartThemeLight The default theme \value ChartThemeBlueCerulean \value ChartThemeDark \value ChartThemeBrownSand diff --git a/src/qchart.h b/src/qchart.h index dbe4839..c35213e 100644 --- a/src/qchart.h +++ b/src/qchart.h @@ -40,8 +40,7 @@ class QTCOMMERCIALCHART_EXPORT QChart : public QGraphicsWidget public: enum ChartTheme { - ChartThemeDefault, - ChartThemeLight, + ChartThemeLight = 0, ChartThemeBlueCerulean, ChartThemeDark, ChartThemeBrownSand, diff --git a/src/themes/chartthemedefault_p.h b/src/themes/chartthemedefault_p.h deleted file mode 100644 index 4b882d7..0000000 --- a/src/themes/chartthemedefault_p.h +++ /dev/null @@ -1,170 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc -** All rights reserved. -** For any questions to Digia, please use contact form at http://qt.digia.com -** -** This file is part of the Qt Commercial Charts Add-on. -** -** $QT_BEGIN_LICENSE$ -** Licensees holding valid Qt Commercial licenses may use this file in -** accordance with the Qt Commercial License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. -** -** If you have questions regarding the use of this file, please use -** contact form at http://qt.digia.com -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef CHARTTHEMEDEFAULT_P_H -#define CHARTTHEMEDEFAULT_P_H - -#include "charttheme_p.h" -#ifdef Q_OS_WIN -#include -#include -#endif - -QTCOMMERCIALCHART_BEGIN_NAMESPACE - -class ChartThemeDefault: public ChartTheme -{ -public: - ChartThemeDefault() : ChartTheme(QChart::ChartThemeDefault) - { -#ifdef Q_OS_WIN - // TODO: use theme specific window frame color as a series base color (it would give more - // variation to the base colors in addition to the blue and black used now) - // TODO: COLOR_WINDOWTEXT for text color? - // TODO: COLOR_INFOTEXT for tooltip text color? - // TODO: COLOR_INFOBK for tooltip background color? - - // First series base color from COLOR_HIGHLIGHT - DWORD colorHighlight; - colorHighlight = GetSysColor(COLOR_HIGHLIGHT); - m_seriesColors.append(QColor(GetRValue(colorHighlight), - GetGValue(colorHighlight), - GetBValue(colorHighlight))); - - // Second series base color from COLOR_WINDOWFRAME - DWORD colorWindowFrame; - colorWindowFrame = GetSysColor(COLOR_WINDOWFRAME); - m_seriesColors.append(QColor(GetRValue(colorWindowFrame), - GetGValue(colorWindowFrame), - GetBValue(colorWindowFrame))); - - // Third series base color from the middle of the COLOR_ACTIVECAPTION / - // COLOR_GRADIENTACTIVECAPTION gradient - DWORD colorGradientActiveCaptionLeft; - colorGradientActiveCaptionLeft = GetSysColor(COLOR_ACTIVECAPTION); - DWORD colorGradientActiveCaptionRight; - colorGradientActiveCaptionRight = GetSysColor(COLOR_GRADIENTACTIVECAPTION); - QLinearGradient g; - QColor start = QColor(GetRValue(colorGradientActiveCaptionLeft), - GetGValue(colorGradientActiveCaptionLeft), - GetBValue(colorGradientActiveCaptionLeft)); - g.setColorAt(0.0, start); - QColor end = QColor(GetRValue(colorGradientActiveCaptionRight), - GetGValue(colorGradientActiveCaptionRight), - GetBValue(colorGradientActiveCaptionRight)); - g.setColorAt(1.0, end); - m_seriesColors.append(colorAt(g, 0.5)); - - // Generate gradients from the base colors - generateSeriesGradients(); - - // Background fill color from COLOR_WINDOW - QLinearGradient backgroundGradient; - DWORD colorWindow; - colorWindow = GetSysColor(COLOR_WINDOW); - backgroundGradient.setColorAt(0.0, QColor(GetRValue(colorWindow), - GetGValue(colorWindow), - GetBValue(colorWindow))); - backgroundGradient.setColorAt(1.0, QColor(GetRValue(colorWindow), - GetGValue(colorWindow), - GetBValue(colorWindow))); - // Axes and other - 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 - m_seriesColors << QRgb(0x60a6e6); - m_seriesColors << QRgb(0x92ca66); - m_seriesColors << QRgb(0xeba85f); - m_seriesColors << QRgb(0xfc5751); - generateSeriesGradients(); - - // Background - QLinearGradient backgroundGradient; - backgroundGradient.setColorAt(0.0, QRgb(0xffffff)); - backgroundGradient.setColorAt(1.0, QRgb(0xffffff)); - backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode); - m_chartBackgroundGradient = backgroundGradient; - - // Axes and other - 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 - m_seriesColors << QRgb(0x60a6e6); - m_seriesColors << QRgb(0x92ca66); - m_seriesColors << QRgb(0xeba85f); - m_seriesColors << QRgb(0xfc5751); - generateSeriesGradients(); - - // Background - QLinearGradient backgroundGradient; - backgroundGradient.setColorAt(0.0, QRgb(0xffffff)); - backgroundGradient.setColorAt(1.0, QRgb(0xffffff)); - backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode); - m_chartBackgroundGradient = backgroundGradient; - - // Axes and other - 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 - m_seriesColors << QRgb(0x60a6e6); - m_seriesColors << QRgb(0x92ca66); - m_seriesColors << QRgb(0xeba85f); - m_seriesColors << QRgb(0xfc5751); - generateSeriesGradients(); - - // Background - QLinearGradient backgroundGradient; - backgroundGradient.setColorAt(0.0, QRgb(0xffffff)); - backgroundGradient.setColorAt(1.0, QRgb(0xffffff)); - backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode); - m_chartBackgroundGradient = backgroundGradient; - - // Axes and other - 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 - } -}; - -QTCOMMERCIALCHART_END_NAMESPACE - -#endif diff --git a/src/themes/themes.pri b/src/themes/themes.pri index 5d39cd9..a32ce57 100644 --- a/src/themes/themes.pri +++ b/src/themes/themes.pri @@ -2,7 +2,7 @@ INCLUDEPATH += $$PWD DEPENDPATH += $$PWD THEMES += \ - $$PWD/chartthemedefault_p.h \ + $$PWD/chartthemesystem_p.h \ $$PWD/chartthemelight_p.h \ $$PWD/chartthemebluecerulean_p.h \ $$PWD/chartthemedark_p.h \