@@ -196,6 +196,7 void AbstractBarChartItem::handleOpacityChanged() | |||||
196 |
|
196 | |||
197 | void AbstractBarChartItem::handleUpdatedBars() |
|
197 | void AbstractBarChartItem::handleUpdatedBars() | |
198 | { |
|
198 | { | |
|
199 | if (!m_series->d_func()->blockBarUpdate()) { | |||
199 | // Handle changes in pen, brush, labels etc. |
|
200 | // Handle changes in pen, brush, labels etc. | |
200 | int categoryCount = m_series->d_func()->categoryCount(); |
|
201 | int categoryCount = m_series->d_func()->categoryCount(); | |
201 | int setCount = m_series->count(); |
|
202 | int setCount = m_series->count(); | |
@@ -218,6 +219,7 void AbstractBarChartItem::handleUpdatedBars() | |||||
218 | } |
|
219 | } | |
219 | } |
|
220 | } | |
220 | } |
|
221 | } | |
|
222 | } | |||
221 |
|
223 | |||
222 | #include "moc_abstractbarchartitem_p.cpp" |
|
224 | #include "moc_abstractbarchartitem_p.cpp" | |
223 |
|
225 |
@@ -413,7 +413,8 QAbstractBarSeriesPrivate::QAbstractBarSeriesPrivate(QAbstractBarSeries *q) : | |||||
413 | QAbstractSeriesPrivate(q), |
|
413 | QAbstractSeriesPrivate(q), | |
414 | m_barWidth(0.5), // Default value is 50% of category width |
|
414 | m_barWidth(0.5), // Default value is 50% of category width | |
415 | m_labelsVisible(false), |
|
415 | m_labelsVisible(false), | |
416 | m_visible(true) |
|
416 | m_visible(true), | |
|
417 | m_blockBarUpdate(false) | |||
417 | { |
|
418 | { | |
418 | } |
|
419 | } | |
419 |
|
420 | |||
@@ -652,6 +653,10 qreal QAbstractBarSeriesPrivate::bottom() | |||||
652 | return bottom; |
|
653 | return bottom; | |
653 | } |
|
654 | } | |
654 |
|
655 | |||
|
656 | bool QAbstractBarSeriesPrivate::blockBarUpdate() | |||
|
657 | { | |||
|
658 | return m_blockBarUpdate; | |||
|
659 | } | |||
655 |
|
660 | |||
656 | void QAbstractBarSeriesPrivate::initializeDomain() |
|
661 | void QAbstractBarSeriesPrivate::initializeDomain() | |
657 | { |
|
662 | { | |
@@ -843,6 +848,8 QAbstractAxis* QAbstractBarSeriesPrivate::createDefaultAxis(Qt::Orientation orie | |||||
843 |
|
848 | |||
844 | void QAbstractBarSeriesPrivate::initializeTheme(int index, ChartTheme* theme, bool forced) |
|
849 | void QAbstractBarSeriesPrivate::initializeTheme(int index, ChartTheme* theme, bool forced) | |
845 | { |
|
850 | { | |
|
851 | m_blockBarUpdate = true; // Ensures that the bars are not updated before the theme is ready | |||
|
852 | ||||
846 | const QList<QGradient> gradients = theme->seriesGradients(); |
|
853 | const QList<QGradient> gradients = theme->seriesGradients(); | |
847 |
|
854 | |||
848 | qreal takeAtPos = 0.5; |
|
855 | qreal takeAtPos = 0.5; | |
@@ -875,12 +882,13 void QAbstractBarSeriesPrivate::initializeTheme(int index, ChartTheme* theme, bo | |||||
875 | else |
|
882 | else | |
876 | m_barSets.at(i)->setLabelBrush(ChartThemeManager::colorAt(gradients.at(index % gradients.size()), 0)); |
|
883 | m_barSets.at(i)->setLabelBrush(ChartThemeManager::colorAt(gradients.at(index % gradients.size()), 0)); | |
877 | } |
|
884 | } | |
878 |
|
||||
879 | if (forced || QChartPrivate::defaultPen() == m_barSets.at(i)->d_ptr->m_pen) { |
|
885 | if (forced || QChartPrivate::defaultPen() == m_barSets.at(i)->d_ptr->m_pen) { | |
880 | QColor c = ChartThemeManager::colorAt(gradients.at(index % gradients.size()), 0.0); |
|
886 | QColor c = ChartThemeManager::colorAt(gradients.at(index % gradients.size()), 0.0); | |
881 | m_barSets.at(i)->setPen(c); |
|
887 | m_barSets.at(i)->setPen(c); | |
882 | } |
|
888 | } | |
883 | } |
|
889 | } | |
|
890 | m_blockBarUpdate = false; | |||
|
891 | emit updatedBars(); | |||
884 | } |
|
892 | } | |
885 |
|
893 | |||
886 | void QAbstractBarSeriesPrivate::initializeAnimations(QChart::AnimationOptions options) |
|
894 | void QAbstractBarSeriesPrivate::initializeAnimations(QChart::AnimationOptions options) |
@@ -85,6 +85,8 public: | |||||
85 | qreal top(); |
|
85 | qreal top(); | |
86 | qreal bottom(); |
|
86 | qreal bottom(); | |
87 |
|
87 | |||
|
88 | bool blockBarUpdate(); | |||
|
89 | ||||
88 | Q_SIGNALS: |
|
90 | Q_SIGNALS: | |
89 | void clicked(int index, QBarSet *barset); |
|
91 | void clicked(int index, QBarSet *barset); | |
90 | void updatedBars(); |
|
92 | void updatedBars(); | |
@@ -101,6 +103,7 protected: | |||||
101 | qreal m_barWidth; |
|
103 | qreal m_barWidth; | |
102 | bool m_labelsVisible; |
|
104 | bool m_labelsVisible; | |
103 | bool m_visible; |
|
105 | bool m_visible; | |
|
106 | bool m_blockBarUpdate; | |||
104 |
|
107 | |||
105 | private: |
|
108 | private: | |
106 | Q_DECLARE_PUBLIC(QAbstractBarSeries) |
|
109 | Q_DECLARE_PUBLIC(QAbstractBarSeries) |
General Comments 0
You need to be logged in to leave comments.
Login now