summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoni Poikelin <joni.poikelin@qt.io>2017-12-12 11:26:42 +0200
committerJoni Poikelin <joni.poikelin@qt.io>2017-12-12 19:49:38 +0000
commitad9d59e871b6f1a7b3f0b0ae1248ffa205647993 (patch)
tree2891f9b08a2dc50989ecd85239679c868864bdf4
parentb6345dd9f244423090a91d15124b7e1fdb280436 (diff)
Hide labels from removed bars
Task-number: QTBUG-62210 Change-Id: I9c2ef7a1ef4a6b28fd7348eae51e0068b99d4b3d Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
-rw-r--r--src/charts/barchart/abstractbarchartitem.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/charts/barchart/abstractbarchartitem.cpp b/src/charts/barchart/abstractbarchartitem.cpp
index 910066b5..f435044e 100644
--- a/src/charts/barchart/abstractbarchartitem.cpp
+++ b/src/charts/barchart/abstractbarchartitem.cpp
@@ -394,6 +394,15 @@ void AbstractBarChartItem::handleBarValueRemove(int index, int count, QBarSet *b
// Value removals from the middle of barset need to dirty the rest of the labels of the set.
markLabelsDirty(barset, index, -1);
+
+ // make sure labels are not visible for removed bars
+ const auto bars = m_barMap.value(barset);
+ for (int c = barset->count(); c < bars.count(); ++c) {
+ auto label = bars.at(c)->labelItem();
+ if (label)
+ label->setVisible(false);
+ }
+
handleLayoutChanged();
}