##// END OF EJS Templates
BarSet label brush is no longer reset to theme default brush if it was preset earlier
Marek Rosa -
r1760:10a2cce6b5a9
parent child
Show More
@@ -522,7 +522,11 QColor QBarSet::labelColor()
522 */
522 */
523 void QBarSet::setLabelColor(QColor color)
523 void QBarSet::setLabelColor(QColor color)
524 {
524 {
525 QBrush defaultBrush;
525 QBrush b = labelBrush();
526 QBrush b = labelBrush();
527 if (b == defaultBrush)
528 b.setStyle(Qt::SolidPattern);
529
526 if (b.color() != color) {
530 if (b.color() != color) {
527 b.setColor(color);
531 b.setColor(color);
528 setLabelBrush(b);
532 setLabelBrush(b);
@@ -82,22 +82,22 ChartTheme::ChartTheme(QChart::ChartTheme id) :
82 ChartTheme* ChartTheme::createTheme(QChart::ChartTheme theme)
82 ChartTheme* ChartTheme::createTheme(QChart::ChartTheme theme)
83 {
83 {
84 switch(theme) {
84 switch(theme) {
85 case QChart::ChartThemeLight:
85 case QChart::ChartThemeLight:
86 return new ChartThemeLight();
86 return new ChartThemeLight();
87 case QChart::ChartThemeBlueCerulean:
87 case QChart::ChartThemeBlueCerulean:
88 return new ChartThemeBlueCerulean();
88 return new ChartThemeBlueCerulean();
89 case QChart::ChartThemeDark:
89 case QChart::ChartThemeDark:
90 return new ChartThemeDark();
90 return new ChartThemeDark();
91 case QChart::ChartThemeBrownSand:
91 case QChart::ChartThemeBrownSand:
92 return new ChartThemeBrownSand();
92 return new ChartThemeBrownSand();
93 case QChart::ChartThemeBlueNcs:
93 case QChart::ChartThemeBlueNcs:
94 return new ChartThemeBlueNcs();
94 return new ChartThemeBlueNcs();
95 case QChart::ChartThemeHighContrast:
95 case QChart::ChartThemeHighContrast:
96 return new ChartThemeHighContrast();
96 return new ChartThemeHighContrast();
97 case QChart::ChartThemeBlueIcy:
97 case QChart::ChartThemeBlueIcy:
98 return new ChartThemeBlueIcy();
98 return new ChartThemeBlueIcy();
99 default:
99 default:
100 return new ChartThemeSystem();
100 return new ChartThemeSystem();
101 }
101 }
102 }
102 }
103
103
@@ -143,8 +143,8 void ChartTheme::decorate(QAreaSeries *series, int index)
143 }
143 }
144
144
145 if (brush == series->brush() || m_force) {
145 if (brush == series->brush() || m_force) {
146 QBrush brush(m_seriesColors.at(index % m_seriesColors.size()));
146 QBrush brush(m_seriesColors.at(index % m_seriesColors.size()));
147 series->setBrush(brush);
147 series->setBrush(brush);
148 }
148 }
149 }
149 }
150
150
@@ -189,10 +189,12 void ChartTheme::decorate(QAbstractBarSeries *series, int index)
189
189
190 // Pick label color from the opposite end of the gradient.
190 // Pick label color from the opposite end of the gradient.
191 // 0.3 as a boundary seems to work well.
191 // 0.3 as a boundary seems to work well.
192 if (takeAtPos < 0.3)
192 if (brush == sets.at(i)->labelBrush() || m_force) {
193 sets.at(i)->setLabelBrush(colorAt(m_seriesGradients.at(index % m_seriesGradients.size()), 1));
193 if (takeAtPos < 0.3)
194 else
194 sets.at(i)->setLabelBrush(colorAt(m_seriesGradients.at(index % m_seriesGradients.size()), 1));
195 sets.at(i)->setLabelBrush(colorAt(m_seriesGradients.at(index % m_seriesGradients.size()), 0));
195 else
196 sets.at(i)->setLabelBrush(colorAt(m_seriesGradients.at(index % m_seriesGradients.size()), 0));
197 }
196
198
197 if (pen == sets.at(i)->pen() || m_force) {
199 if (pen == sets.at(i)->pen() || m_force) {
198 QColor c = colorAt(m_seriesGradients.at(index % m_seriesGradients.size()), 0.0);
200 QColor c = colorAt(m_seriesGradients.at(index % m_seriesGradients.size()), 0.0);
@@ -274,23 +276,23 void ChartTheme::decorate(QAbstractAxis *axis)
274 }
276 }
275
277
276
278
277 if (axis->shadesVisible() || m_force) {
279 if (axis->shadesVisible() || m_force) {
278
280
279 if(brush == axis->shadesBrush() || m_force){
281 if(brush == axis->shadesBrush() || m_force){
280 axis->setShadesBrush(m_backgroundShadesBrush);
282 axis->setShadesBrush(m_backgroundShadesBrush);
281 }
283 }
282
284
283 if(pen == axis->shadesPen() || m_force){
285 if(pen == axis->shadesPen() || m_force){
284 axis->setShadesPen(m_backgroundShadesPen);
286 axis->setShadesPen(m_backgroundShadesPen);
285 }
287 }
286
288
287 if( m_force && (m_backgroundShades == BackgroundShadesBoth
289 if( m_force && (m_backgroundShades == BackgroundShadesBoth
288 || (m_backgroundShades == BackgroundShadesVertical && axisX)
290 || (m_backgroundShades == BackgroundShadesVertical && axisX)
289 || (m_backgroundShades == BackgroundShadesHorizontal && !axisX))){
291 || (m_backgroundShades == BackgroundShadesHorizontal && !axisX))){
290 axis->setShadesVisible(true);
292 axis->setShadesVisible(true);
291
293
292 }
294 }
293 }
295 }
294
296
295 if(pen == axis->axisPen() || m_force){
297 if(pen == axis->axisPen() || m_force){
296 axis->setAxisPen(m_axisLinePen);
298 axis->setAxisPen(m_axisLinePen);
General Comments 0
You need to be logged in to leave comments. Login now