QVariantAnimation: fix binding loops
Rewrite the logic of the setters to use removeBindingUnlessInWrapper() and {set}ValueBypassingBindings() calls. The logic of both setters didn't change, because previously the pre-existing bindings were implicitly removed when calling the assignment operator. The new code just makes it explicit. Task-number: QTBUG-116346 Change-Id: I475e6cd65fc73796176f257835cb67b9e70a1e34 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> (cherry picked from commit df9651c3fcdd026255add31744b2f75dc2ecdd62) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
d2891e5d01
commit
75dc131a28
@ -353,8 +353,9 @@ QEasingCurve QVariantAnimation::easingCurve() const
|
||||
void QVariantAnimation::setEasingCurve(const QEasingCurve &easing)
|
||||
{
|
||||
Q_D(QVariantAnimation);
|
||||
const bool valueChanged = easing != d->easing;
|
||||
d->easing = easing;
|
||||
d->easing.removeBindingUnlessInWrapper();
|
||||
const bool valueChanged = easing != d->easing.valueBypassingBindings();
|
||||
d->easing.setValueBypassingBindings(easing);
|
||||
d->recalculateCurrentInterval();
|
||||
if (valueChanged)
|
||||
d->easing.notify();
|
||||
@ -482,13 +483,12 @@ void QVariantAnimation::setDuration(int msecs)
|
||||
qWarning("QVariantAnimation::setDuration: cannot set a negative duration");
|
||||
return;
|
||||
}
|
||||
if (d->duration == msecs) {
|
||||
d->duration.removeBindingUnlessInWrapper();
|
||||
return;
|
||||
d->duration.removeBindingUnlessInWrapper();
|
||||
if (d->duration.valueBypassingBindings() != msecs) {
|
||||
d->duration.setValueBypassingBindings(msecs);
|
||||
d->recalculateCurrentInterval();
|
||||
d->duration.notify();
|
||||
}
|
||||
d->duration = msecs;
|
||||
d->recalculateCurrentInterval();
|
||||
d->duration.notify();
|
||||
}
|
||||
|
||||
QBindable<int> QVariantAnimation::bindableDuration()
|
||||
|
Loading…
x
Reference in New Issue
Block a user