summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAndy Shaw <andy.shaw@qt.io>2017-08-23 09:52:48 +0200
committerAndy Shaw <andy.shaw@qt.io>2017-08-23 15:09:33 +0000
commit5261307d061a2b925faffb6ea21aa3dbca1e50a9 (patch)
treeaa6f1903b9936c51091958ce373c1b5811ae39d8 /src
parent1f47b1a7ae58702dccc57a9ccbaa905441f4fecb (diff)
Account for very small numbers when setting the range
When using qFuzzyCompare it would not allow for very small numbers so we remove that need and do a straight compare instead. This also includes a test to check that zooming and then resetting gets us back to the original range. Task-number: QTBUG-56097 Change-Id: I722be55f602c936e03fe3cc57c30ba15c0e0bed0 Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/charts/axis/valueaxis/qvalueaxis.cpp16
1 files changed, 2 insertions, 14 deletions
diff --git a/src/charts/axis/valueaxis/qvalueaxis.cpp b/src/charts/axis/valueaxis/qvalueaxis.cpp
index e8f9698f..42dd8ed9 100644
--- a/src/charts/axis/valueaxis/qvalueaxis.cpp
+++ b/src/charts/axis/valueaxis/qvalueaxis.cpp
@@ -408,25 +408,13 @@ void QValueAxisPrivate::setRange(qreal min, qreal max)
return;
}
- bool changeMin = false;
- if (m_min == 0 || min == 0)
- changeMin = !qFuzzyCompare(1 + m_min, 1 + min);
- else
- changeMin = !qFuzzyCompare(m_min, min);
-
- bool changeMax = false;
- if (m_max == 0 || max == 0)
- changeMax = !qFuzzyCompare(1 + m_max, 1 + max);
- else
- changeMax = !qFuzzyCompare(m_max, max);
-
- if (changeMin) {
+ if (m_min != min) {
m_min = min;
changed = true;
emit q->minChanged(min);
}
- if (changeMax) {
+ if (m_max != max) {
m_max = max;
changed = true;
emit q->maxChanged(max);