diff options
author | Andy Shaw <andy.shaw@qt.io> | 2017-11-29 09:41:16 +0100 |
---|---|---|
committer | Andy Shaw <andy.shaw@qt.io> | 2017-12-01 09:18:39 +0000 |
commit | 6cde98b2254e6197a285a83617c952fd1d14cb3d (patch) | |
tree | c47bbac09fa33a207b0fa4b700d67b92bfad8e2f /src | |
parent | 5d2cb8a429a7ed6244e80973cfcf94740859e174 (diff) |
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 <miikka.heikkinen@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/charts/axis/chartaxiselement.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
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); |