From 6cde98b2254e6197a285a83617c952fd1d14cb3d Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Wed, 29 Nov 2017 09:41:16 +0100 Subject: When passing empty QStrings as label format should revert to the default This ensures that the QML and widgets side both behave in the same way as the QML side handled an empty string as reverting back to the default. Whereas the widget side did not, now it will ensure that it is consistent. Change-Id: Ibc3f149f1761586e5fa04420e3b78bed169304d1 Reviewed-by: Miikka Heikkinen --- src/charts/axis/chartaxiselement.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/charts/axis/chartaxiselement.cpp b/src/charts/axis/chartaxiselement.cpp index c5a1ab91..5282ee36 100644 --- a/src/charts/axis/chartaxiselement.cpp +++ b/src/charts/axis/chartaxiselement.cpp @@ -343,7 +343,7 @@ QStringList ChartAxisElement::createValueLabels(qreal min, qreal max, int ticks, if (max <= min || ticks < 1) return labels; - if (format.isNull()) { + if (format.isEmpty()) { int n = qMax(int(-qFloor(std::log10((max - min) / (ticks - 1)))), 0) + 1; for (int i = 0; i < ticks; i++) { qreal value = min + (i * (max - min) / (ticks - 1)); @@ -395,7 +395,7 @@ QStringList ChartAxisElement::createLogValueLabels(qreal min, qreal max, qreal b else firstTick = qCeil(std::log10(max) / std::log10(base)); - if (format.isNull()) { + if (format.isEmpty()) { int n = 0; if (ticks > 1) n = qMax(int(-qFloor(std::log10((max - min) / (ticks - 1)))), 0); -- cgit v1.2.3 From ad9d59e871b6f1a7b3f0b0ae1248ffa205647993 Mon Sep 17 00:00:00 2001 From: Joni Poikelin Date: Tue, 12 Dec 2017 11:26:42 +0200 Subject: Hide labels from removed bars Task-number: QTBUG-62210 Change-Id: I9c2ef7a1ef4a6b28fd7348eae51e0068b99d4b3d Reviewed-by: Miikka Heikkinen --- src/charts/barchart/abstractbarchartitem.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src') 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(); } -- cgit v1.2.3