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