@@ -252,6 +252,9 void QAreaSeries::setPen(const QPen &pen) | |||||
252 |
QPen |
|
252 | QPen QAreaSeries::pen() const | |
253 | { |
|
253 | { | |
254 | Q_D(const QAreaSeries); |
|
254 | Q_D(const QAreaSeries); | |
|
255 | if (d->m_pen == QChartPrivate::defaultPen()) | |||
|
256 | return QPen(); | |||
|
257 | else | |||
255 | return d->m_pen; |
|
258 | return d->m_pen; | |
256 | } |
|
259 | } | |
257 |
|
260 | |||
@@ -273,6 +276,9 void QAreaSeries::setBrush(const QBrush &brush) | |||||
273 | QBrush QAreaSeries::brush() const |
|
276 | QBrush QAreaSeries::brush() const | |
274 | { |
|
277 | { | |
275 | Q_D(const QAreaSeries); |
|
278 | Q_D(const QAreaSeries); | |
|
279 | if (d->m_brush == QChartPrivate::defaultBrush()) | |||
|
280 | return QBrush(); | |||
|
281 | else | |||
276 | return d->m_brush; |
|
282 | return d->m_brush; | |
277 | } |
|
283 | } | |
278 |
|
284 |
@@ -458,6 +458,9 void QAbstractAxis::setLinePen(const QPen &pen) | |||||
458 | */ |
|
458 | */ | |
459 | QPen QAbstractAxis::linePen() const |
|
459 | QPen QAbstractAxis::linePen() const | |
460 | { |
|
460 | { | |
|
461 | if (d_ptr->m_axisPen == QChartPrivate::defaultPen()) | |||
|
462 | return QPen(); | |||
|
463 | else | |||
461 | return d_ptr->m_axisPen; |
|
464 | return d_ptr->m_axisPen; | |
462 | } |
|
465 | } | |
463 |
|
466 | |||
@@ -474,7 +477,7 void QAbstractAxis::setLinePenColor(QColor color) | |||||
474 |
|
477 | |||
475 | QColor QAbstractAxis::linePenColor() const |
|
478 | QColor QAbstractAxis::linePenColor() const | |
476 | { |
|
479 | { | |
477 |
return |
|
480 | return linePen().color(); | |
478 | } |
|
481 | } | |
479 |
|
482 | |||
480 | /*! |
|
483 | /*! | |
@@ -522,6 +525,9 void QAbstractAxis::setGridLinePen(const QPen &pen) | |||||
522 | */ |
|
525 | */ | |
523 | QPen QAbstractAxis::gridLinePen() const |
|
526 | QPen QAbstractAxis::gridLinePen() const | |
524 | { |
|
527 | { | |
|
528 | if (d_ptr->m_gridLinePen == QChartPrivate::defaultPen()) | |||
|
529 | return QPen(); | |||
|
530 | else | |||
525 | return d_ptr->m_gridLinePen; |
|
531 | return d_ptr->m_gridLinePen; | |
526 | } |
|
532 | } | |
527 |
|
533 | |||
@@ -554,6 +560,9 void QAbstractAxis::setLabelsPen(const QPen &pen) | |||||
554 | */ |
|
560 | */ | |
555 | QPen QAbstractAxis::labelsPen() const |
|
561 | QPen QAbstractAxis::labelsPen() const | |
556 | { |
|
562 | { | |
|
563 | if (d_ptr->m_labelsPen == QChartPrivate::defaultPen()) | |||
|
564 | return QPen(); | |||
|
565 | else | |||
557 | return d_ptr->m_labelsPen; |
|
566 | return d_ptr->m_labelsPen; | |
558 | } |
|
567 | } | |
559 |
|
568 | |||
@@ -573,6 +582,9 void QAbstractAxis::setLabelsBrush(const QBrush &brush) | |||||
573 | */ |
|
582 | */ | |
574 | QBrush QAbstractAxis::labelsBrush() const |
|
583 | QBrush QAbstractAxis::labelsBrush() const | |
575 | { |
|
584 | { | |
|
585 | if (d_ptr->m_labelsBrush == QChartPrivate::defaultBrush()) | |||
|
586 | return QBrush(); | |||
|
587 | else | |||
576 | return d_ptr->m_labelsBrush; |
|
588 | return d_ptr->m_labelsBrush; | |
577 | } |
|
589 | } | |
578 |
|
590 | |||
@@ -592,6 +604,9 void QAbstractAxis::setLabelsFont(const QFont &font) | |||||
592 | */ |
|
604 | */ | |
593 | QFont QAbstractAxis::labelsFont() const |
|
605 | QFont QAbstractAxis::labelsFont() const | |
594 | { |
|
606 | { | |
|
607 | if (d_ptr->m_labelsFont == QChartPrivate::defaultFont()) | |||
|
608 | return QFont(); | |||
|
609 | else | |||
595 | return d_ptr->m_labelsFont; |
|
610 | return d_ptr->m_labelsFont; | |
596 | } |
|
611 | } | |
597 |
|
612 | |||
@@ -620,7 +635,7 void QAbstractAxis::setLabelsColor(QColor color) | |||||
620 |
|
635 | |||
621 | QColor QAbstractAxis::labelsColor() const |
|
636 | QColor QAbstractAxis::labelsColor() const | |
622 | { |
|
637 | { | |
623 |
return |
|
638 | return labelsBrush().color(); | |
624 | } |
|
639 | } | |
625 |
|
640 | |||
626 | void QAbstractAxis::setTitleVisible(bool visible) |
|
641 | void QAbstractAxis::setTitleVisible(bool visible) | |
@@ -652,6 +667,9 void QAbstractAxis::setTitlePen(const QPen &pen) | |||||
652 | */ |
|
667 | */ | |
653 | QPen QAbstractAxis::titlePen() const |
|
668 | QPen QAbstractAxis::titlePen() const | |
654 | { |
|
669 | { | |
|
670 | if (d_ptr->m_titlePen == QChartPrivate::defaultPen()) | |||
|
671 | return QPen(); | |||
|
672 | else | |||
655 | return d_ptr->m_titlePen; |
|
673 | return d_ptr->m_titlePen; | |
656 | } |
|
674 | } | |
657 |
|
675 | |||
@@ -671,6 +689,9 void QAbstractAxis::setTitleBrush(const QBrush &brush) | |||||
671 | */ |
|
689 | */ | |
672 |
QBrush |
|
690 | QBrush QAbstractAxis::titleBrush() const | |
673 | { |
|
691 | { | |
|
692 | if (d_ptr->m_titleBrush == QChartPrivate::defaultBrush()) | |||
|
693 | return QBrush(); | |||
|
694 | else | |||
674 | return d_ptr->m_titleBrush; |
|
695 | return d_ptr->m_titleBrush; | |
675 | } |
|
696 | } | |
676 |
|
697 | |||
@@ -690,6 +711,9 void QAbstractAxis::setTitleFont(const QFont &font) | |||||
690 | */ |
|
711 | */ | |
691 | QFont QAbstractAxis::titleFont() const |
|
712 | QFont QAbstractAxis::titleFont() const | |
692 | { |
|
713 | { | |
|
714 | if (d_ptr->m_titleFont == QChartPrivate::defaultFont()) | |||
|
715 | return QFont(); | |||
|
716 | else | |||
693 | return d_ptr->m_titleFont; |
|
717 | return d_ptr->m_titleFont; | |
694 | } |
|
718 | } | |
695 |
|
719 | |||
@@ -736,6 +760,9 void QAbstractAxis::setShadesPen(const QPen &pen) | |||||
736 | */ |
|
760 | */ | |
737 | QPen QAbstractAxis::shadesPen() const |
|
761 | QPen QAbstractAxis::shadesPen() const | |
738 | { |
|
762 | { | |
|
763 | if (d_ptr->m_shadesPen == QChartPrivate::defaultPen()) | |||
|
764 | return QPen(); | |||
|
765 | else | |||
739 | return d_ptr->m_shadesPen; |
|
766 | return d_ptr->m_shadesPen; | |
740 | } |
|
767 | } | |
741 |
|
768 | |||
@@ -755,6 +782,9 void QAbstractAxis::setShadesBrush(const QBrush &brush) | |||||
755 | */ |
|
782 | */ | |
756 | QBrush QAbstractAxis::shadesBrush() const |
|
783 | QBrush QAbstractAxis::shadesBrush() const | |
757 | { |
|
784 | { | |
|
785 | if (d_ptr->m_shadesBrush == QChartPrivate::defaultBrush()) | |||
|
786 | return QBrush(Qt::SolidPattern); | |||
|
787 | else | |||
758 | return d_ptr->m_shadesBrush; |
|
788 | return d_ptr->m_shadesBrush; | |
759 | } |
|
789 | } | |
760 |
|
790 | |||
@@ -770,7 +800,7 void QAbstractAxis::setShadesColor(QColor color) | |||||
770 |
|
800 | |||
771 | QColor QAbstractAxis::shadesColor() const |
|
801 | QColor QAbstractAxis::shadesColor() const | |
772 | { |
|
802 | { | |
773 |
return |
|
803 | return shadesBrush().color(); | |
774 | } |
|
804 | } | |
775 |
|
805 | |||
776 | void QAbstractAxis::setShadesBorderColor(QColor color) |
|
806 | void QAbstractAxis::setShadesBorderColor(QColor color) | |
@@ -785,7 +815,7 void QAbstractAxis::setShadesBorderColor(QColor color) | |||||
785 |
|
815 | |||
786 | QColor QAbstractAxis::shadesBorderColor() const |
|
816 | QColor QAbstractAxis::shadesBorderColor() const | |
787 | { |
|
817 | { | |
788 |
return |
|
818 | return shadesPen().color(); | |
789 | } |
|
819 | } | |
790 |
|
820 | |||
791 |
|
821 |
@@ -862,19 +862,19 void QAbstractBarSeriesPrivate::initializeTheme(int index, ChartTheme* theme, bo | |||||
862 | takeAtPos += step; |
|
862 | takeAtPos += step; | |
863 | takeAtPos -= (int) takeAtPos; |
|
863 | takeAtPos -= (int) takeAtPos; | |
864 | } |
|
864 | } | |
865 |
if (forced || QChartPrivate::defaultBrush() == m_barSets.at(i)->brush |
|
865 | if (forced || QChartPrivate::defaultBrush() == m_barSets.at(i)->d_ptr->m_brush) | |
866 | m_barSets.at(i)->setBrush(ChartThemeManager::colorAt(gradients.at(colorIndex), takeAtPos)); |
|
866 | m_barSets.at(i)->setBrush(ChartThemeManager::colorAt(gradients.at(colorIndex), takeAtPos)); | |
867 |
|
867 | |||
868 | // Pick label color from the opposite end of the gradient. |
|
868 | // Pick label color from the opposite end of the gradient. | |
869 | // 0.3 as a boundary seems to work well. |
|
869 | // 0.3 as a boundary seems to work well. | |
870 |
if (forced || QChartPrivate::defaultBrush() == m_barSets.at(i)->labelBrush |
|
870 | if (forced || QChartPrivate::defaultBrush() == m_barSets.at(i)->d_ptr->m_labelBrush) { | |
871 | if (takeAtPos < 0.3) |
|
871 | if (takeAtPos < 0.3) | |
872 | 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)); | |
873 | else |
|
873 | else | |
874 | 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)); | |
875 | } |
|
875 | } | |
876 |
|
876 | |||
877 |
if (forced || QChartPrivate::defaultPen() == m_barSets.at(i)->pen |
|
877 | if (forced || QChartPrivate::defaultPen() == m_barSets.at(i)->d_ptr->m_pen) { | |
878 | QColor c = ChartThemeManager::colorAt(gradients.at(index % gradients.size()), 0.0); |
|
878 | QColor c = ChartThemeManager::colorAt(gradients.at(index % gradients.size()), 0.0); | |
879 | m_barSets.at(i)->setPen(c); |
|
879 | m_barSets.at(i)->setPen(c); | |
880 | } |
|
880 | } |
@@ -76,6 +76,7 protected: | |||||
76 | friend class HorizontalBarChartItem; |
|
76 | friend class HorizontalBarChartItem; | |
77 | friend class HorizontalStackedBarChartItem; |
|
77 | friend class HorizontalStackedBarChartItem; | |
78 | friend class HorizontalPercentBarChartItem; |
|
78 | friend class HorizontalPercentBarChartItem; | |
|
79 | friend class BarSet; | |||
79 | }; |
|
80 | }; | |
80 |
|
81 | |||
81 | QTCOMMERCIALCHART_END_NAMESPACE |
|
82 | QTCOMMERCIALCHART_END_NAMESPACE |
@@ -406,6 +406,9 void QBarSet::setPen(const QPen &pen) | |||||
406 | */ |
|
406 | */ | |
407 | QPen QBarSet::pen() const |
|
407 | QPen QBarSet::pen() const | |
408 | { |
|
408 | { | |
|
409 | if (d_ptr->m_pen == QChartPrivate::defaultPen()) | |||
|
410 | return QPen(); | |||
|
411 | else | |||
409 | return d_ptr->m_pen; |
|
412 | return d_ptr->m_pen; | |
410 | } |
|
413 | } | |
411 |
|
414 | |||
@@ -426,6 +429,9 void QBarSet::setBrush(const QBrush &brush) | |||||
426 | */ |
|
429 | */ | |
427 | QBrush QBarSet::brush() const |
|
430 | QBrush QBarSet::brush() const | |
428 | { |
|
431 | { | |
|
432 | if (d_ptr->m_brush == QChartPrivate::defaultBrush()) | |||
|
433 | return QBrush(); | |||
|
434 | else | |||
429 | return d_ptr->m_brush; |
|
435 | return d_ptr->m_brush; | |
430 | } |
|
436 | } | |
431 |
|
437 | |||
@@ -446,6 +452,9 void QBarSet::setLabelBrush(const QBrush &brush) | |||||
446 | */ |
|
452 | */ | |
447 | QBrush QBarSet::labelBrush() const |
|
453 | QBrush QBarSet::labelBrush() const | |
448 | { |
|
454 | { | |
|
455 | if (d_ptr->m_labelBrush == QChartPrivate::defaultBrush()) | |||
|
456 | return QBrush(); | |||
|
457 | else | |||
449 | return d_ptr->m_labelBrush; |
|
458 | return d_ptr->m_labelBrush; | |
450 | } |
|
459 | } | |
451 |
|
460 |
@@ -432,6 +432,9 void QXYSeries::setPen(const QPen &pen) | |||||
432 | QPen QXYSeries::pen() const |
|
432 | QPen QXYSeries::pen() const | |
433 | { |
|
433 | { | |
434 | Q_D(const QXYSeries); |
|
434 | Q_D(const QXYSeries); | |
|
435 | if (d->m_pen == QChartPrivate::defaultPen()) | |||
|
436 | return QPen(); | |||
|
437 | else | |||
435 | return d->m_pen; |
|
438 | return d->m_pen; | |
436 | } |
|
439 | } | |
437 |
|
440 | |||
@@ -452,6 +455,9 void QXYSeries::setBrush(const QBrush &brush) | |||||
452 | QBrush QXYSeries::brush() const |
|
455 | QBrush QXYSeries::brush() const | |
453 | { |
|
456 | { | |
454 | Q_D(const QXYSeries); |
|
457 | Q_D(const QXYSeries); | |
|
458 | if (d->m_brush == QChartPrivate::defaultBrush()) | |||
|
459 | return QBrush(); | |||
|
460 | else | |||
455 | return d->m_brush; |
|
461 | return d->m_brush; | |
456 | } |
|
462 | } | |
457 |
|
463 |
@@ -476,7 +476,7 void tst_QBarSet::customize() | |||||
476 | series->append(set2); |
|
476 | series->append(set2); | |
477 |
|
477 | |||
478 | QVERIFY(set1->brush() == brush); // Should be customized |
|
478 | QVERIFY(set1->brush() == brush); // Should be customized | |
479 |
QVERIFY(set2->brush() |
|
479 | QVERIFY(set2->brush() == QBrush()); // Setting empty brush doesn't reset to theme brush | |
480 |
|
480 | |||
481 | // Remove sets from series |
|
481 | // Remove sets from series | |
482 | series->take(set1); |
|
482 | series->take(set1); | |
@@ -491,7 +491,7 void tst_QBarSet::customize() | |||||
491 | series->append(set1); |
|
491 | series->append(set1); | |
492 | series->append(set2); |
|
492 | series->append(set2); | |
493 |
QVERIFY(set1->labelBrush() == brush); |
|
493 | QVERIFY(set1->labelBrush() == brush); // Should be customized | |
494 |
QVERIFY(set2->labelBrush() |
|
494 | QVERIFY(set2->labelBrush() == QBrush()); // Setting empty brush doesn't reset to theme brush | |
495 |
|
495 | |||
496 | // Test label font |
|
496 | // Test label font | |
497 | // Note: QFont empty constructor creates font with application's default font, so the font may or may not be the |
|
497 | // Note: QFont empty constructor creates font with application's default font, so the font may or may not be the |
General Comments 0
You need to be logged in to leave comments.
Login now