##// END OF EJS Templates
Fix color setting...
Titta Heikkala -
r2852:5f71da41b84f
parent child
Show More
@@ -514,7 +514,7 QPen QAbstractAxis::linePen() const
514 514
515 515 void QAbstractAxis::setLinePenColor(QColor color)
516 516 {
517 QPen p = d_ptr->m_axisPen;
517 QPen p = linePen();
518 518 if (p.color() != color) {
519 519 p.setColor(color);
520 520 setLinePen(p);
@@ -609,7 +609,7 QPen QAbstractAxis::minorGridLinePen() const
609 609
610 610 void QAbstractAxis::setGridLineColor(const QColor &color)
611 611 {
612 QPen pen = d_ptr->m_gridLinePen;
612 QPen pen = gridLinePen();
613 613 if (color != pen.color()) {
614 614 pen.setColor(color);
615 615 d_ptr->m_gridLinePen = pen;
@@ -624,7 +624,7 QColor QAbstractAxis::gridLineColor()
624 624
625 625 void QAbstractAxis::setMinorGridLineColor(const QColor &color)
626 626 {
627 QPen pen = d_ptr->m_minorGridLinePen;
627 QPen pen = minorGridLinePen();
628 628 if (color != pen.color()) {
629 629 pen.setColor(color);
630 630 d_ptr->m_minorGridLinePen = pen;
@@ -708,7 +708,7 int QAbstractAxis::labelsAngle() const
708 708 }
709 709 void QAbstractAxis::setLabelsColor(QColor color)
710 710 {
711 QBrush b = d_ptr->m_labelsBrush;
711 QBrush b = labelsBrush();
712 712 if (b.color() != color) {
713 713 b.setColor(color);
714 714 setLabelsBrush(b);
@@ -851,7 +851,7 QBrush QAbstractAxis::shadesBrush() const
851 851
852 852 void QAbstractAxis::setShadesColor(QColor color)
853 853 {
854 QBrush b = d_ptr->m_shadesBrush;
854 QBrush b = shadesBrush();
855 855 if (b.color() != color) {
856 856 b.setColor(color);
857 857 setShadesBrush(b);
@@ -237,12 +237,15 void QLegend::setBrush(const QBrush &brush)
237 237 */
238 238 QBrush QLegend::brush() const
239 239 {
240 if (d_ptr->m_brush == QChartPrivate::defaultBrush())
241 return QBrush();
242 else
240 243 return d_ptr->m_brush;
241 244 }
242 245
243 246 void QLegend::setColor(QColor color)
244 247 {
245 QBrush b = d_ptr->m_brush;
248 QBrush b = brush();
246 249 if (b.style() != Qt::SolidPattern || b.color() != color) {
247 250 b.setStyle(Qt::SolidPattern);
248 251 b.setColor(color);
@@ -273,6 +276,9 void QLegend::setPen(const QPen &pen)
273 276
274 277 QPen QLegend::pen() const
275 278 {
279 if (d_ptr->m_pen == QChartPrivate::defaultPen())
280 return QPen();
281 else
276 282 return d_ptr->m_pen;
277 283 }
278 284
@@ -297,7 +303,7 QFont QLegend::font() const
297 303
298 304 void QLegend::setBorderColor(QColor color)
299 305 {
300 QPen p = d_ptr->m_pen;
306 QPen p = pen();
301 307 if (p.color() != color) {
302 308 p.setColor(color);
303 309 setPen(p);
@@ -331,12 +337,15 void QLegend::setLabelBrush(const QBrush &brush)
331 337 */
332 338 QBrush QLegend::labelBrush() const
333 339 {
340 if (d_ptr->m_labelBrush == QChartPrivate::defaultBrush())
341 return QBrush();
342 else
334 343 return d_ptr->m_labelBrush;
335 344 }
336 345
337 346 void QLegend::setLabelColor(QColor color)
338 347 {
339 QBrush b = d_ptr->m_labelBrush;
348 QBrush b = labelBrush();
340 349 if (b.style() != Qt::SolidPattern || b.color() != color) {
341 350 b.setStyle(Qt::SolidPattern);
342 351 b.setColor(color);
@@ -466,9 +475,9 QLegendPrivate::QLegendPrivate(ChartPresenter *presenter, QChart *chart, QLegend
466 475 m_chart(chart),
467 476 m_items(new QGraphicsItemGroup(q)),
468 477 m_alignment(Qt::AlignTop),
469 m_brush(QBrush()),
470 m_pen(QPen()),
471 m_labelBrush(QBrush()),
478 m_brush(QChartPrivate::defaultBrush()),
479 m_pen(QChartPrivate::defaultPen()),
480 m_labelBrush(QChartPrivate::defaultBrush()),
472 481 m_diameter(5),
473 482 m_attachedToChart(true),
474 483 m_backgroundVisible(false),
General Comments 0
You need to be logged in to leave comments. Login now