##// END OF EJS Templates
Fix explicitly set default pen/brush/font getting overridden by theme...
Miikka Heikkinen -
r2516:567bb8091928
parent child
Show More
@@ -331,6 +331,8 bool QAreaSeries::pointsVisible() const
331
331
332 QAreaSeriesPrivate::QAreaSeriesPrivate(QLineSeries *upperSeries, QLineSeries *lowerSeries, QAreaSeries *q)
332 QAreaSeriesPrivate::QAreaSeriesPrivate(QLineSeries *upperSeries, QLineSeries *lowerSeries, QAreaSeries *q)
333 : QAbstractSeriesPrivate(q),
333 : QAbstractSeriesPrivate(q),
334 m_brush(QChartPrivate::defaultBrush()),
335 m_pen(QChartPrivate::defaultPen()),
334 m_upperSeries(upperSeries),
336 m_upperSeries(upperSeries),
335 m_lowerSeries(lowerSeries),
337 m_lowerSeries(lowerSeries),
336 m_pointsVisible(false)
338 m_pointsVisible(false)
@@ -427,19 +429,18 QAbstractAxis* QAreaSeriesPrivate::createDefaultAxis(Qt::Orientation orientation
427 void QAreaSeriesPrivate::initializeTheme(int index, ChartTheme* theme, bool forced)
429 void QAreaSeriesPrivate::initializeTheme(int index, ChartTheme* theme, bool forced)
428 {
430 {
429 Q_Q(QAreaSeries);
431 Q_Q(QAreaSeries);
430 QPen pen;
431 QBrush brush;
432
432
433 const QList<QGradient> gradients = theme->seriesGradients();
433 const QList<QGradient> gradients = theme->seriesGradients();
434 const QList<QColor> colors = theme->seriesColors();
434 const QList<QColor> colors = theme->seriesColors();
435
435
436 if (forced || pen == m_pen) {
436 if (forced || QChartPrivate::defaultPen() == m_pen) {
437 QPen pen;
437 pen.setColor(ChartThemeManager::colorAt(gradients.at(index % gradients.size()), 0.0));
438 pen.setColor(ChartThemeManager::colorAt(gradients.at(index % gradients.size()), 0.0));
438 pen.setWidthF(2);
439 pen.setWidthF(2);
439 q->setPen(pen);
440 q->setPen(pen);
440 }
441 }
441
442
442 if (forced || brush == m_brush) {
443 if (forced || QChartPrivate::defaultBrush() == m_brush) {
443 QBrush brush(colors.at(index % colors.size()));
444 QBrush brush(colors.at(index % colors.size()));
444 q->setBrush(brush);
445 q->setBrush(brush);
445 }
446 }
@@ -22,6 +22,7
22 #include "qabstractaxis_p.h"
22 #include "qabstractaxis_p.h"
23 #include "chartdataset_p.h"
23 #include "chartdataset_p.h"
24 #include "charttheme_p.h"
24 #include "charttheme_p.h"
25 #include "qchart_p.h"
25
26
26 QTCOMMERCIALCHART_BEGIN_NAMESPACE
27 QTCOMMERCIALCHART_BEGIN_NAMESPACE
27
28
@@ -876,16 +877,25 QAbstractAxisPrivate::QAbstractAxisPrivate(QAbstractAxis *q)
876 m_orientation(Qt::Orientation(0)),
877 m_orientation(Qt::Orientation(0)),
877 m_visible(true),
878 m_visible(true),
878 m_arrowVisible(true),
879 m_arrowVisible(true),
880 m_axisPen(QChartPrivate::defaultPen()),
881 m_axisBrush(QChartPrivate::defaultBrush()),
879 m_gridLineVisible(true),
882 m_gridLineVisible(true),
883 m_gridLinePen(QChartPrivate::defaultPen()),
880 m_labelsVisible(true),
884 m_labelsVisible(true),
885 m_labelsPen(QChartPrivate::defaultPen()),
886 m_labelsBrush(QChartPrivate::defaultBrush()),
887 m_labelsFont(QChartPrivate::defaultFont()),
881 m_labelsAngle(0),
888 m_labelsAngle(0),
882 m_titleVisible(true),
889 m_titleVisible(true),
890 m_titlePen(QChartPrivate::defaultPen()),
891 m_titleBrush(QChartPrivate::defaultBrush()),
892 m_titleFont(QChartPrivate::defaultFont()),
883 m_shadesVisible(false),
893 m_shadesVisible(false),
884 m_shadesBrush(Qt::SolidPattern),
894 m_shadesBrush(QChartPrivate::defaultBrush()),
895 m_shadesPen(QChartPrivate::defaultPen()),
885 m_shadesOpacity(1.0),
896 m_shadesOpacity(1.0),
886 m_dirty(false)
897 m_dirty(false)
887 {
898 {
888
889 }
899 }
890
900
891 QAbstractAxisPrivate::~QAbstractAxisPrivate()
901 QAbstractAxisPrivate::~QAbstractAxisPrivate()
@@ -912,61 +922,42 void QAbstractAxisPrivate::setAlignment( Qt::Alignment alignment)
912
922
913 void QAbstractAxisPrivate::initializeTheme(ChartTheme* theme, bool forced)
923 void QAbstractAxisPrivate::initializeTheme(ChartTheme* theme, bool forced)
914 {
924 {
915 QPen pen;
916 QBrush brush;
917 QFont font;
918
919 bool axisX = m_orientation == Qt::Horizontal;
920
921 //TODO: introduce axis brush
925 //TODO: introduce axis brush
922 if (m_visible) {
926 if (forced || QChartPrivate::defaultPen() == m_axisPen)
923 if (m_arrowVisible) {
924 if (forced || pen == m_axisPen) {
925 q_ptr->setLinePen(theme->axisLinePen());
927 q_ptr->setLinePen(theme->axisLinePen());
926 }
928
927 }
929 if (forced || QChartPrivate::defaultPen() == m_gridLinePen)
928 if (m_gridLineVisible) {
929 if (forced || pen == m_gridLinePen) {
930 q_ptr->setGridLinePen(theme->girdLinePen());
930 q_ptr->setGridLinePen(theme->girdLinePen());
931 }
931
932 }
932 if (forced || QChartPrivate::defaultBrush() == m_labelsBrush)
933 if (m_labelsVisible) {
934 if (forced || brush == m_labelsBrush){
935 q_ptr->setLabelsBrush(theme->labelBrush());
933 q_ptr->setLabelsBrush(theme->labelBrush());
936 }
934 if (forced || QChartPrivate::defaultPen() == m_labelsPen)
937 if (forced || pen == m_labelsPen){
938 q_ptr->setLabelsPen(Qt::NoPen);// NoPen for performance reasons
935 q_ptr->setLabelsPen(Qt::NoPen); // NoPen for performance reasons
939 }
936 if (forced || QChartPrivate::defaultFont() == m_labelsFont)
940 if (forced || font == m_labelsFont){
941 q_ptr->setLabelsFont(theme->labelFont());
937 q_ptr->setLabelsFont(theme->labelFont());
942 }
938
943 }
939 if (forced || QChartPrivate::defaultBrush() == m_titleBrush)
944 if (m_titleVisible) {
945 if (forced || brush == m_titleBrush){
946 q_ptr->setTitleBrush(theme->labelBrush());
940 q_ptr->setTitleBrush(theme->labelBrush());
947 }
941 if (forced || QChartPrivate::defaultPen() == m_titlePen)
948 if (forced || pen == m_titlePen){
942 q_ptr->setTitlePen(Qt::NoPen); // NoPen for performance reasons
949 q_ptr->setTitlePen(Qt::NoPen);// Noen for performance reasons
943 if (forced || QChartPrivate::defaultFont() == m_titleFont) {
950 }
951 if (forced || font == m_titleFont){
952 QFont font(m_labelsFont);
944 QFont font(m_labelsFont);
953 font.setBold(true);
945 font.setBold(true);
954 q_ptr->setTitleFont(font);
946 q_ptr->setTitleFont(font);
955 }
947 }
956 }
948
957 if (forced || m_shadesVisible) {
949 if (forced || QChartPrivate::defaultBrush() == m_shadesBrush)
958 if (forced || brush == m_shadesBrush){
959 q_ptr->setShadesBrush(theme->backgroundShadesBrush());
950 q_ptr->setShadesBrush(theme->backgroundShadesBrush());
960 }
951 if (forced || QChartPrivate::defaultPen() == m_shadesPen)
961 if (forced || pen == m_shadesPen){
962 q_ptr->setShadesPen(theme->backgroundShadesPen());
952 q_ptr->setShadesPen(theme->backgroundShadesPen());
963 }
953
954 bool axisX = m_orientation == Qt::Horizontal;
964 if (forced && (theme->backgroundShades() == ChartTheme::BackgroundShadesBoth
955 if (forced && (theme->backgroundShades() == ChartTheme::BackgroundShadesBoth
965 || (theme->backgroundShades() == ChartTheme::BackgroundShadesVertical && axisX)
956 || (theme->backgroundShades() == ChartTheme::BackgroundShadesVertical && axisX)
966 || (theme->backgroundShades() == ChartTheme::BackgroundShadesHorizontal && !axisX))) {
957 || (theme->backgroundShades() == ChartTheme::BackgroundShadesHorizontal && !axisX))) {
967 q_ptr->setShadesVisible(true);
958 q_ptr->setShadesVisible(true);
968 }
959 } else if (forced) {
969 }
960 q_ptr->setShadesVisible(false);
970 }
961 }
971 }
962 }
972
963
@@ -85,6 +85,7 protected:
85 QAbstractAxis *q_ptr;
85 QAbstractAxis *q_ptr;
86 QChart *m_chart;
86 QChart *m_chart;
87 QScopedPointer<ChartAxisElement> m_item;
87 QScopedPointer<ChartAxisElement> m_item;
88
88 private:
89 private:
89 QList<QAbstractSeries*> m_series;
90 QList<QAbstractSeries*> m_series;
90
91
@@ -30,6 +30,7
30 #include "qbarlegendmarker.h"
30 #include "qbarlegendmarker.h"
31 #include "baranimation_p.h"
31 #include "baranimation_p.h"
32 #include "abstractbarchartitem_p.h"
32 #include "abstractbarchartitem_p.h"
33 #include "qchart_p.h"
33
34
34 QTCOMMERCIALCHART_BEGIN_NAMESPACE
35 QTCOMMERCIALCHART_BEGIN_NAMESPACE
35
36
@@ -842,9 +843,6 void QAbstractBarSeriesPrivate::initializeTheme(int index, ChartTheme* theme, bo
842 {
843 {
843 const QList<QGradient> gradients = theme->seriesGradients();
844 const QList<QGradient> gradients = theme->seriesGradients();
844
845
845 QBrush brush;
846 QPen pen;
847
848 qreal takeAtPos = 0.5;
846 qreal takeAtPos = 0.5;
849 qreal step = 0.2;
847 qreal step = 0.2;
850 if (m_barSets.count() > 1) {
848 if (m_barSets.count() > 1) {
@@ -864,19 +862,19 void QAbstractBarSeriesPrivate::initializeTheme(int index, ChartTheme* theme, bo
864 takeAtPos += step;
862 takeAtPos += step;
865 takeAtPos -= (int) takeAtPos;
863 takeAtPos -= (int) takeAtPos;
866 }
864 }
867 if (forced || brush == m_barSets.at(i)->brush())
865 if (forced || QChartPrivate::defaultBrush() == m_barSets.at(i)->brush())
868 m_barSets.at(i)->setBrush(ChartThemeManager::colorAt(gradients.at(colorIndex), takeAtPos));
866 m_barSets.at(i)->setBrush(ChartThemeManager::colorAt(gradients.at(colorIndex), takeAtPos));
869
867
870 // Pick label color from the opposite end of the gradient.
868 // Pick label color from the opposite end of the gradient.
871 // 0.3 as a boundary seems to work well.
869 // 0.3 as a boundary seems to work well.
872 if (forced || brush == m_barSets.at(i)->labelBrush()) {
870 if (forced || QChartPrivate::defaultBrush() == m_barSets.at(i)->labelBrush()) {
873 if (takeAtPos < 0.3)
871 if (takeAtPos < 0.3)
874 m_barSets.at(i)->setLabelBrush(ChartThemeManager::colorAt(gradients.at(index % gradients.size()), 1));
872 m_barSets.at(i)->setLabelBrush(ChartThemeManager::colorAt(gradients.at(index % gradients.size()), 1));
875 else
873 else
876 m_barSets.at(i)->setLabelBrush(ChartThemeManager::colorAt(gradients.at(index % gradients.size()), 0));
874 m_barSets.at(i)->setLabelBrush(ChartThemeManager::colorAt(gradients.at(index % gradients.size()), 0));
877 }
875 }
878
876
879 if (forced || pen == m_barSets.at(i)->pen()) {
877 if (forced || QChartPrivate::defaultPen() == m_barSets.at(i)->pen()) {
880 QColor c = ChartThemeManager::colorAt(gradients.at(index % gradients.size()), 0.0);
878 QColor c = ChartThemeManager::colorAt(gradients.at(index % gradients.size()), 0.0);
881 m_barSets.at(i)->setPen(c);
879 m_barSets.at(i)->setPen(c);
882 }
880 }
@@ -21,6 +21,7
21 #include "qbarset.h"
21 #include "qbarset.h"
22 #include "qbarset_p.h"
22 #include "qbarset_p.h"
23 #include "charthelpers_p.h"
23 #include "charthelpers_p.h"
24 #include "qchart_p.h"
24
25
25 QTCOMMERCIALCHART_BEGIN_NAMESPACE
26 QTCOMMERCIALCHART_BEGIN_NAMESPACE
26
27
@@ -546,7 +547,10 void QBarSet::setLabelColor(QColor color)
546
547
547 QBarSetPrivate::QBarSetPrivate(const QString label, QBarSet *parent) : QObject(parent),
548 QBarSetPrivate::QBarSetPrivate(const QString label, QBarSet *parent) : QObject(parent),
548 q_ptr(parent),
549 q_ptr(parent),
549 m_label(label)
550 m_label(label),
551 m_pen(QChartPrivate::defaultPen()),
552 m_brush(QChartPrivate::defaultBrush()),
553 m_labelBrush(QChartPrivate::defaultBrush())
550 {
554 {
551 }
555 }
552
556
@@ -152,7 +152,8 void ChartPresenter::createBackgroundItem()
152 {
152 {
153 if (!m_background) {
153 if (!m_background) {
154 m_background = new ChartBackground(rootItem());
154 m_background = new ChartBackground(rootItem());
155 m_background->setPen(Qt::NoPen);
155 m_background->setPen(Qt::NoPen); // Theme doesn't touch pen so don't use default
156 m_background->setBrush(QChartPrivate::defaultBrush());
156 m_background->setZValue(ChartPresenter::BackgroundZValue);
157 m_background->setZValue(ChartPresenter::BackgroundZValue);
157 }
158 }
158 }
159 }
@@ -41,8 +41,7 ChartThemeManager::ChartThemeManager(QChart* chart) :
41
41
42 void ChartThemeManager::setTheme(QChart::ChartTheme theme)
42 void ChartThemeManager::setTheme(QChart::ChartTheme theme)
43 {
43 {
44 if(m_theme.isNull() || theme != m_theme->id())
44 if (m_theme.isNull() || theme != m_theme->id()) {
45 {
46 switch (theme) {
45 switch (theme) {
47 case QChart::ChartThemeLight:
46 case QChart::ChartThemeLight:
48 m_theme.reset(new ChartThemeLight());
47 m_theme.reset(new ChartThemeLight());
@@ -70,57 +69,39 void ChartThemeManager::setTheme(QChart::ChartTheme theme)
70 break;
69 break;
71 }
70 }
72
71
73 if(!m_theme.isNull())
72 if (!m_theme.isNull()) {
74 {
73 decorateChart(m_chart,m_theme.data());
75 decorateChart(m_chart,m_theme.data(),true);
74 decorateLegend(m_chart->legend(),m_theme.data());
76 decorateLegend(m_chart->legend(),m_theme.data(),true);
75 foreach (QAbstractAxis* axis, m_axisList)
77 foreach(QAbstractAxis* axis, m_axisList) {
78 axis->d_ptr->initializeTheme(m_theme.data(),true);
76 axis->d_ptr->initializeTheme(m_theme.data(), true);
79 }
77 foreach (QAbstractSeries* series, m_seriesMap.keys())
80 foreach(QAbstractSeries* series, m_seriesMap.keys()) {
81 series->d_ptr->initializeTheme(m_seriesMap[series],m_theme.data(),true);
78 series->d_ptr->initializeTheme(m_seriesMap[series], m_theme.data(), true);
82 }
79 }
83
84 }
85 }
80 }
86 }
81 }
87
82
88 void ChartThemeManager::decorateChart(QChart *chart,ChartTheme* theme,bool force) const
83 // decorateChart is only called when theme is forcibly initialized
84 void ChartThemeManager::decorateChart(QChart *chart, ChartTheme *theme) const
89 {
85 {
90 QBrush brush;
91
92 if (force || brush == chart->backgroundBrush())
93 chart->setBackgroundBrush(theme->chartBackgroundGradient());
86 chart->setBackgroundBrush(theme->chartBackgroundGradient());
94
87
95 if (force) {
96 // Always clear plotArea brush when forced update, do not touch otherwise
97 QPen pen(Qt::transparent);
88 QPen pen(Qt::transparent);
89 QBrush brush;
98 chart->setPlotAreaBackgroundBrush(brush);
90 chart->setPlotAreaBackgroundBrush(brush);
99 chart->setPlotAreaBackgroundPen(pen);
91 chart->setPlotAreaBackgroundPen(pen);
100 chart->setPlotAreaBackgroundVisible(false);
92 chart->setPlotAreaBackgroundVisible(false);
101 }
102
93
103 chart->setTitleFont(theme->masterFont());
94 chart->setTitleFont(theme->masterFont());
104 chart->setTitleBrush(theme->labelBrush());
95 chart->setTitleBrush(theme->labelBrush());
105 chart->setDropShadowEnabled(theme->isBackgroundDropShadowEnabled());
96 chart->setDropShadowEnabled(theme->isBackgroundDropShadowEnabled());
106 }
97 }
107
98
108 void ChartThemeManager::decorateLegend(QLegend *legend, ChartTheme* theme, bool force) const
99 // decorateLegend is only called when theme is forcibly initialized
100 void ChartThemeManager::decorateLegend(QLegend *legend, ChartTheme *theme) const
109 {
101 {
110 QPen pen;
111 QBrush brush;
112 QFont font;
113
114 if (force || pen == legend->pen())
115 legend->setPen(theme->axisLinePen());
102 legend->setPen(theme->axisLinePen());
116
117 if (force || brush == legend->brush())
118 legend->setBrush(theme->chartBackgroundGradient());
103 legend->setBrush(theme->chartBackgroundGradient());
119
120 if (force || font == legend->font())
121 legend->setFont(theme->labelFont());
104 legend->setFont(theme->labelFont());
122
123 if (force || brush == legend->labelBrush())
124 legend->setLabelBrush(theme->labelBrush());
105 legend->setLabelBrush(theme->labelBrush());
125 }
106 }
126
107
@@ -53,8 +53,8 public:
53 explicit ChartThemeManager(QChart* chart);
53 explicit ChartThemeManager(QChart* chart);
54 void setTheme(QChart::ChartTheme theme);
54 void setTheme(QChart::ChartTheme theme);
55 ChartTheme* theme() const { return m_theme.data(); }
55 ChartTheme* theme() const { return m_theme.data(); }
56 void decorateChart(QChart *chart, ChartTheme* theme, bool force = false) const;
56 void decorateChart(QChart *chart, ChartTheme* theme) const;
57 void decorateLegend(QLegend *legend, ChartTheme* theme, bool force = false) const;
57 void decorateLegend(QLegend *legend, ChartTheme* theme) const;
58 void updateSeries(QAbstractSeries *series);
58 void updateSeries(QAbstractSeries *series);
59
59
60 public:
60 public:
@@ -23,7 +23,7
23 #include "linechartitem_p.h"
23 #include "linechartitem_p.h"
24 #include "chartdataset_p.h"
24 #include "chartdataset_p.h"
25 #include "charttheme_p.h"
25 #include "charttheme_p.h"
26
26 #include "qchart_p.h"
27 QTCOMMERCIALCHART_BEGIN_NAMESPACE
27 QTCOMMERCIALCHART_BEGIN_NAMESPACE
28
28
29 /*!
29 /*!
@@ -149,8 +149,8 void QLineSeriesPrivate::initializeTheme(int index, ChartTheme* theme, bool forc
149 Q_Q(QLineSeries);
149 Q_Q(QLineSeries);
150 const QList<QColor> colors = theme->seriesColors();
150 const QList<QColor> colors = theme->seriesColors();
151
151
152 if (forced || QChartPrivate::defaultPen() == m_pen) {
152 QPen pen;
153 QPen pen;
153 if (forced || pen == m_pen) {
154 pen.setColor(colors.at(index % colors.size()));
154 pen.setColor(colors.at(index % colors.size()));
155 pen.setWidthF(2);
155 pen.setWidthF(2);
156 q->setPen(pen);
156 q->setPen(pen);
@@ -687,6 +687,36 QChartPrivate::~QChartPrivate()
687 {
687 {
688 }
688 }
689
689
690 // Hackish solution to the problem of explicitly assigning the default pen/brush/font
691 // to a series or axis and having theme override it:
692 // Initialize pens, brushes, and fonts to something nobody is likely to ever use,
693 // so that default theme initialization will always set these properly.
694 QPen &QChartPrivate::defaultPen()
695 {
696 static QPen *defaultPen = 0;
697 if (!defaultPen)
698 defaultPen = new QPen(QColor(1, 2, 0), 0.93247536);
699 return *defaultPen;
700 }
701
702 QBrush &QChartPrivate::defaultBrush()
703 {
704 static QBrush *defaultBrush = 0;
705 if (!defaultBrush)
706 defaultBrush = new QBrush(QColor(1, 2, 0), Qt::Dense7Pattern);
707 return *defaultBrush;
708 }
709
710 QFont &QChartPrivate::defaultFont()
711 {
712 static QFont *defaultFont = 0;
713 if (!defaultFont) {
714 defaultFont = new QFont();
715 defaultFont->setPointSizeF(8.34563465);
716 }
717 return *defaultFont;
718 }
719
690 void QChartPrivate::init()
720 void QChartPrivate::init()
691 {
721 {
692 m_legend = new LegendScroller(q_ptr);
722 m_legend = new LegendScroller(q_ptr);
@@ -53,6 +53,10 public:
53 ChartThemeManager *m_themeManager;
53 ChartThemeManager *m_themeManager;
54 QChart::ChartType m_type;
54 QChart::ChartType m_type;
55
55
56 static QPen &defaultPen();
57 static QBrush &defaultBrush();
58 static QFont &defaultFont();
59
56 void init();
60 void init();
57 void zoomIn(qreal factor);
61 void zoomIn(qreal factor);
58 void zoomOut(qreal factor);
62 void zoomOut(qreal factor);
@@ -24,6 +24,7
24 #include "chartdataset_p.h"
24 #include "chartdataset_p.h"
25 #include "charttheme_p.h"
25 #include "charttheme_p.h"
26 #include "scatteranimation_p.h"
26 #include "scatteranimation_p.h"
27 #include "qchart_p.h"
27
28
28 /*!
29 /*!
29 \class QScatterSeries
30 \class QScatterSeries
@@ -266,18 +267,17 void QScatterSeriesPrivate::initializeGraphics(QGraphicsItem* parent)
266 void QScatterSeriesPrivate::initializeTheme(int index, ChartTheme* theme, bool forced)
267 void QScatterSeriesPrivate::initializeTheme(int index, ChartTheme* theme, bool forced)
267 {
268 {
268 Q_Q(QScatterSeries);
269 Q_Q(QScatterSeries);
269 QPen pen;
270 QBrush brush;
271 const QList<QColor> colors = theme->seriesColors();
270 const QList<QColor> colors = theme->seriesColors();
272 const QList<QGradient> gradients = theme->seriesGradients();
271 const QList<QGradient> gradients = theme->seriesGradients();
273
272
274 if (forced || pen == m_pen) {
273 if (forced || QChartPrivate::defaultPen() == m_pen) {
274 QPen pen;
275 pen.setColor(ChartThemeManager::colorAt(gradients.at(index % gradients.size()), 0.0));
275 pen.setColor(ChartThemeManager::colorAt(gradients.at(index % gradients.size()), 0.0));
276 pen.setWidthF(2);
276 pen.setWidthF(2);
277 q->setPen(pen);
277 q->setPen(pen);
278 }
278 }
279
279
280 if (forced || brush == m_brush) {
280 if (forced || QChartPrivate::defaultBrush() == m_brush) {
281 QBrush brush(colors.at(index % colors.size()));
281 QBrush brush(colors.at(index % colors.size()));
282 q->setBrush(brush);
282 q->setBrush(brush);
283 }
283 }
@@ -24,6 +24,7
24 #include "chartdataset_p.h"
24 #include "chartdataset_p.h"
25 #include "charttheme_p.h"
25 #include "charttheme_p.h"
26 #include "splineanimation_p.h"
26 #include "splineanimation_p.h"
27 #include "qchart_p.h"
27
28
28 /*!
29 /*!
29 \class QSplineSeries
30 \class QSplineSeries
@@ -126,8 +127,8 void QSplineSeriesPrivate::initializeTheme(int index, ChartTheme* theme, bool fo
126 Q_Q(QSplineSeries);
127 Q_Q(QSplineSeries);
127 const QList<QColor> colors = theme->seriesColors();
128 const QList<QColor> colors = theme->seriesColors();
128
129
130 if (forced || QChartPrivate::defaultPen() == m_pen) {
129 QPen pen;
131 QPen pen;
130 if (forced || pen == m_pen) {
131 pen.setColor(colors.at(index % colors.size()));
132 pen.setColor(colors.at(index % colors.size()));
132 pen.setWidthF(2);
133 pen.setWidthF(2);
133 q->setPen(pen);
134 q->setPen(pen);
@@ -50,7 +50,9 public:
50 protected:
50 protected:
51 explicit ChartTheme(QChart::ChartTheme id = QChart::ChartThemeLight):m_id(id),
51 explicit ChartTheme(QChart::ChartTheme id = QChart::ChartThemeLight):m_id(id),
52 m_backgroundShades(BackgroundShadesNone),
52 m_backgroundShades(BackgroundShadesNone),
53 m_backgroundDropShadowEnabled(false){};
53 m_backgroundShadesBrush(Qt::SolidPattern),
54 m_backgroundDropShadowEnabled(false)
55 {};
54 public:
56 public:
55 QChart::ChartTheme id() const { return m_id; }
57 QChart::ChartTheme id() const { return m_id; }
56 QList<QGradient> seriesGradients() const { return m_seriesGradients; }
58 QList<QGradient> seriesGradients() const { return m_seriesGradients; }
@@ -25,6 +25,7
25 #include "xychart_p.h"
25 #include "xychart_p.h"
26 #include "qxylegendmarker.h"
26 #include "qxylegendmarker.h"
27 #include "charthelpers_p.h"
27 #include "charthelpers_p.h"
28 #include "qchart_p.h"
28
29
29 QTCOMMERCIALCHART_BEGIN_NAMESPACE
30 QTCOMMERCIALCHART_BEGIN_NAMESPACE
30
31
@@ -511,6 +512,8 QXYSeries &QXYSeries::operator<< (const QList<QPointF>& points)
511
512
512 QXYSeriesPrivate::QXYSeriesPrivate(QXYSeries *q)
513 QXYSeriesPrivate::QXYSeriesPrivate(QXYSeries *q)
513 : QAbstractSeriesPrivate(q),
514 : QAbstractSeriesPrivate(q),
515 m_pen(QChartPrivate::defaultPen()),
516 m_brush(QChartPrivate::defaultBrush()),
514 m_pointsVisible(false)
517 m_pointsVisible(false)
515 {
518 {
516 }
519 }
General Comments 0
You need to be logged in to leave comments. Login now