summaryrefslogtreecommitdiff
path: root/src/controls/Private/qquickrangemodel.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/controls/Private/qquickrangemodel.cpp')
-rw-r--r--src/controls/Private/qquickrangemodel.cpp33
1 files changed, 29 insertions, 4 deletions
diff --git a/src/controls/Private/qquickrangemodel.cpp b/src/controls/Private/qquickrangemodel.cpp
index 02ce0e57..36d7dd34 100644
--- a/src/controls/Private/qquickrangemodel.cpp
+++ b/src/controls/Private/qquickrangemodel.cpp
@@ -69,6 +69,9 @@ void QQuickRangeModelPrivate::init()
posatmin = 0;
posatmax = 0;
inverted = false;
+ isComplete = false;
+ positionChanged = false;
+ valueChanged = false;
}
/*!
@@ -155,10 +158,16 @@ void QQuickRangeModelPrivate::emitValueAndPositionIfChanged(const qreal oldValue
// unchanged. This will be the case when operating with values outside range:
const qreal newValue = q->value();
const qreal newPosition = q->position();
- if (!qFuzzyCompare(newValue, oldValue))
- emit q->valueChanged(newValue);
- if (!qFuzzyCompare(newPosition, oldPosition))
- emit q->positionChanged(newPosition);
+
+ if (isComplete) {
+ if (!qFuzzyCompare(newValue, oldValue))
+ emit q->valueChanged(newValue);
+ if (!qFuzzyCompare(newPosition, oldPosition))
+ emit q->positionChanged(newPosition);
+ } else {
+ positionChanged |= qFuzzyCompare(oldPosition, newPosition);
+ valueChanged |= !qFuzzyCompare(oldValue, newValue);
+ }
}
/*!
@@ -346,6 +355,22 @@ qreal QQuickRangeModel::positionForValue(qreal value) const
return d->publicPosition(unconstrainedPosition);
}
+void QQuickRangeModel::classBegin()
+{
+}
+
+void QQuickRangeModel::componentComplete()
+{
+ Q_D(QQuickRangeModel);
+ d->isComplete = true;
+ emit minimumChanged(minimum());
+ emit maximumChanged(maximum());
+ if (d->valueChanged)
+ emit valueChanged(value());
+ if (d->positionChanged)
+ emit positionChanged(position());
+}
+
/*!
\property QQuickRangeModel::position
\brief the current position of the model