@@ -249,10 +249,13 void QAreaSeries::setPen(const QPen &pen) | |||||
249 | } |
|
249 | } | |
250 | } |
|
250 | } | |
251 |
|
251 | |||
252 |
QPen |
|
252 | QPen QAreaSeries::pen() const | |
253 | { |
|
253 | { | |
254 | Q_D(const QAreaSeries); |
|
254 | Q_D(const QAreaSeries); | |
255 | return d->m_pen; |
|
255 | if (d->m_pen == QChartPrivate::defaultPen()) | |
|
256 | return QPen(); | |||
|
257 | else | |||
|
258 | return d->m_pen; | |||
256 | } |
|
259 | } | |
257 |
|
260 | |||
258 | /*! |
|
261 | /*! | |
@@ -273,7 +276,10 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); | |
276 | return d->m_brush; |
|
279 | if (d->m_brush == QChartPrivate::defaultBrush()) | |
|
280 | return QBrush(); | |||
|
281 | else | |||
|
282 | return d->m_brush; | |||
277 | } |
|
283 | } | |
278 |
|
284 | |||
279 | void QAreaSeries::setColor(const QColor &color) |
|
285 | void QAreaSeries::setColor(const QColor &color) |
@@ -458,7 +458,10 void QAbstractAxis::setLinePen(const QPen &pen) | |||||
458 | */ |
|
458 | */ | |
459 | QPen QAbstractAxis::linePen() const |
|
459 | QPen QAbstractAxis::linePen() const | |
460 | { |
|
460 | { | |
461 | return d_ptr->m_axisPen; |
|
461 | if (d_ptr->m_axisPen == QChartPrivate::defaultPen()) | |
|
462 | return QPen(); | |||
|
463 | else | |||
|
464 | return d_ptr->m_axisPen; | |||
462 | } |
|
465 | } | |
463 |
|
466 | |||
464 | //TODO: remove me 2.0 |
|
467 | //TODO: remove me 2.0 | |
@@ -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,7 +525,10 void QAbstractAxis::setGridLinePen(const QPen &pen) | |||||
522 | */ |
|
525 | */ | |
523 | QPen QAbstractAxis::gridLinePen() const |
|
526 | QPen QAbstractAxis::gridLinePen() const | |
524 | { |
|
527 | { | |
525 | return d_ptr->m_gridLinePen; |
|
528 | if (d_ptr->m_gridLinePen == QChartPrivate::defaultPen()) | |
|
529 | return QPen(); | |||
|
530 | else | |||
|
531 | return d_ptr->m_gridLinePen; | |||
526 | } |
|
532 | } | |
527 |
|
533 | |||
528 | void QAbstractAxis::setLabelsVisible(bool visible) |
|
534 | void QAbstractAxis::setLabelsVisible(bool visible) | |
@@ -554,7 +560,10 void QAbstractAxis::setLabelsPen(const QPen &pen) | |||||
554 | */ |
|
560 | */ | |
555 | QPen QAbstractAxis::labelsPen() const |
|
561 | QPen QAbstractAxis::labelsPen() const | |
556 | { |
|
562 | { | |
557 | return d_ptr->m_labelsPen; |
|
563 | if (d_ptr->m_labelsPen == QChartPrivate::defaultPen()) | |
|
564 | return QPen(); | |||
|
565 | else | |||
|
566 | return d_ptr->m_labelsPen; | |||
558 | } |
|
567 | } | |
559 |
|
568 | |||
560 | /*! |
|
569 | /*! | |
@@ -573,7 +582,10 void QAbstractAxis::setLabelsBrush(const QBrush &brush) | |||||
573 | */ |
|
582 | */ | |
574 | QBrush QAbstractAxis::labelsBrush() const |
|
583 | QBrush QAbstractAxis::labelsBrush() const | |
575 | { |
|
584 | { | |
576 | return d_ptr->m_labelsBrush; |
|
585 | if (d_ptr->m_labelsBrush == QChartPrivate::defaultBrush()) | |
|
586 | return QBrush(); | |||
|
587 | else | |||
|
588 | return d_ptr->m_labelsBrush; | |||
577 | } |
|
589 | } | |
578 |
|
590 | |||
579 | /*! |
|
591 | /*! | |
@@ -592,7 +604,10 void QAbstractAxis::setLabelsFont(const QFont &font) | |||||
592 | */ |
|
604 | */ | |
593 | QFont QAbstractAxis::labelsFont() const |
|
605 | QFont QAbstractAxis::labelsFont() const | |
594 | { |
|
606 | { | |
595 | return d_ptr->m_labelsFont; |
|
607 | if (d_ptr->m_labelsFont == QChartPrivate::defaultFont()) | |
|
608 | return QFont(); | |||
|
609 | else | |||
|
610 | return d_ptr->m_labelsFont; | |||
596 | } |
|
611 | } | |
597 |
|
612 | |||
598 | void QAbstractAxis::setLabelsAngle(int angle) |
|
613 | void QAbstractAxis::setLabelsAngle(int angle) | |
@@ -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,7 +667,10 void QAbstractAxis::setTitlePen(const QPen &pen) | |||||
652 | */ |
|
667 | */ | |
653 | QPen QAbstractAxis::titlePen() const |
|
668 | QPen QAbstractAxis::titlePen() const | |
654 | { |
|
669 | { | |
655 | return d_ptr->m_titlePen; |
|
670 | if (d_ptr->m_titlePen == QChartPrivate::defaultPen()) | |
|
671 | return QPen(); | |||
|
672 | else | |||
|
673 | return d_ptr->m_titlePen; | |||
656 | } |
|
674 | } | |
657 |
|
675 | |||
658 | /*! |
|
676 | /*! | |
@@ -669,9 +687,12 void QAbstractAxis::setTitleBrush(const QBrush &brush) | |||||
669 | /*! |
|
687 | /*! | |
670 | Returns brush used to draw title. |
|
688 | Returns brush used to draw title. | |
671 | */ |
|
689 | */ | |
672 |
QBrush |
|
690 | QBrush QAbstractAxis::titleBrush() const | |
673 | { |
|
691 | { | |
674 | return d_ptr->m_titleBrush; |
|
692 | if (d_ptr->m_titleBrush == QChartPrivate::defaultBrush()) | |
|
693 | return QBrush(); | |||
|
694 | else | |||
|
695 | return d_ptr->m_titleBrush; | |||
675 | } |
|
696 | } | |
676 |
|
697 | |||
677 | /*! |
|
698 | /*! | |
@@ -690,7 +711,10 void QAbstractAxis::setTitleFont(const QFont &font) | |||||
690 | */ |
|
711 | */ | |
691 | QFont QAbstractAxis::titleFont() const |
|
712 | QFont QAbstractAxis::titleFont() const | |
692 | { |
|
713 | { | |
693 | return d_ptr->m_titleFont; |
|
714 | if (d_ptr->m_titleFont == QChartPrivate::defaultFont()) | |
|
715 | return QFont(); | |||
|
716 | else | |||
|
717 | return d_ptr->m_titleFont; | |||
694 | } |
|
718 | } | |
695 |
|
719 | |||
696 | void QAbstractAxis::setTitleText(const QString &title) |
|
720 | void QAbstractAxis::setTitleText(const QString &title) | |
@@ -736,7 +760,10 void QAbstractAxis::setShadesPen(const QPen &pen) | |||||
736 | */ |
|
760 | */ | |
737 | QPen QAbstractAxis::shadesPen() const |
|
761 | QPen QAbstractAxis::shadesPen() const | |
738 | { |
|
762 | { | |
739 | return d_ptr->m_shadesPen; |
|
763 | if (d_ptr->m_shadesPen == QChartPrivate::defaultPen()) | |
|
764 | return QPen(); | |||
|
765 | else | |||
|
766 | return d_ptr->m_shadesPen; | |||
740 | } |
|
767 | } | |
741 |
|
768 | |||
742 | /*! |
|
769 | /*! | |
@@ -755,7 +782,10 void QAbstractAxis::setShadesBrush(const QBrush &brush) | |||||
755 | */ |
|
782 | */ | |
756 | QBrush QAbstractAxis::shadesBrush() const |
|
783 | QBrush QAbstractAxis::shadesBrush() const | |
757 | { |
|
784 | { | |
758 | return d_ptr->m_shadesBrush; |
|
785 | if (d_ptr->m_shadesBrush == QChartPrivate::defaultBrush()) | |
|
786 | return QBrush(Qt::SolidPattern); | |||
|
787 | else | |||
|
788 | return d_ptr->m_shadesBrush; | |||
759 | } |
|
789 | } | |
760 |
|
790 | |||
761 | void QAbstractAxis::setShadesColor(QColor color) |
|
791 | void QAbstractAxis::setShadesColor(QColor color) | |
@@ -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,7 +406,10 void QBarSet::setPen(const QPen &pen) | |||||
406 | */ |
|
406 | */ | |
407 | QPen QBarSet::pen() const |
|
407 | QPen QBarSet::pen() const | |
408 | { |
|
408 | { | |
409 | return d_ptr->m_pen; |
|
409 | if (d_ptr->m_pen == QChartPrivate::defaultPen()) | |
|
410 | return QPen(); | |||
|
411 | else | |||
|
412 | return d_ptr->m_pen; | |||
410 | } |
|
413 | } | |
411 |
|
414 | |||
412 | /*! |
|
415 | /*! | |
@@ -426,7 +429,10 void QBarSet::setBrush(const QBrush &brush) | |||||
426 | */ |
|
429 | */ | |
427 | QBrush QBarSet::brush() const |
|
430 | QBrush QBarSet::brush() const | |
428 | { |
|
431 | { | |
429 | return d_ptr->m_brush; |
|
432 | if (d_ptr->m_brush == QChartPrivate::defaultBrush()) | |
|
433 | return QBrush(); | |||
|
434 | else | |||
|
435 | return d_ptr->m_brush; | |||
430 | } |
|
436 | } | |
431 |
|
437 | |||
432 | /*! |
|
438 | /*! | |
@@ -446,7 +452,10 void QBarSet::setLabelBrush(const QBrush &brush) | |||||
446 | */ |
|
452 | */ | |
447 | QBrush QBarSet::labelBrush() const |
|
453 | QBrush QBarSet::labelBrush() const | |
448 | { |
|
454 | { | |
449 | return d_ptr->m_labelBrush; |
|
455 | if (d_ptr->m_labelBrush == QChartPrivate::defaultBrush()) | |
|
456 | return QBrush(); | |||
|
457 | else | |||
|
458 | return d_ptr->m_labelBrush; | |||
450 | } |
|
459 | } | |
451 |
|
460 | |||
452 | /*! |
|
461 | /*! |
@@ -432,7 +432,10 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 | return d->m_pen; |
|
435 | if (d->m_pen == QChartPrivate::defaultPen()) | |
|
436 | return QPen(); | |||
|
437 | else | |||
|
438 | return d->m_pen; | |||
436 | } |
|
439 | } | |
437 |
|
440 | |||
438 | /*! |
|
441 | /*! | |
@@ -452,7 +455,10 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); | |
455 | return d->m_brush; |
|
458 | if (d->m_brush == QChartPrivate::defaultBrush()) | |
|
459 | return QBrush(); | |||
|
460 | else | |||
|
461 | return d->m_brush; | |||
456 | } |
|
462 | } | |
457 |
|
463 | |||
458 | void QXYSeries::setColor(const QColor &color) |
|
464 | void QXYSeries::setColor(const QColor &color) |
@@ -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); | |
@@ -490,8 +490,8 void tst_QBarSet::customize() | |||||
490 |
|
490 | |||
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