diff options
author | Joni Poikelin <joni.poikelin@qt.io> | 2017-12-12 11:26:42 +0200 |
---|---|---|
committer | Joni Poikelin <joni.poikelin@qt.io> | 2017-12-12 19:49:38 +0000 |
commit | ad9d59e871b6f1a7b3f0b0ae1248ffa205647993 (patch) | |
tree | 2891f9b08a2dc50989ecd85239679c868864bdf4 | |
parent | b6345dd9f244423090a91d15124b7e1fdb280436 (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.cpp | 9 |
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(); } |