Do not notify about property changes if the value hasn't changed
After 2ffb91ac59
we manually call notify()
for QObjectCompatProperties. Currently we always call it when setting
values to compat properties, even if the value hasn't actually changed.
Fixed to call notify() only if the value is being changed.
Task-number: QTBUG-85520
Change-Id: I385db84c4009c45406e204b96e0e37ce5fa8882b
Reviewed-by: Andreas Buhr <andreas.buhr@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
This commit is contained in:
parent
0c9fc20e7f
commit
a4d1ed854d
@ -129,8 +129,13 @@ void QPauseAnimation::setDuration(int msecs)
|
||||
return;
|
||||
}
|
||||
Q_D(QPauseAnimation);
|
||||
d->duration.setValue(msecs);
|
||||
d->duration.notify();
|
||||
|
||||
if (msecs != d->duration) {
|
||||
d->duration = msecs;
|
||||
d->duration.notify();
|
||||
} else {
|
||||
d->duration.removeBindingUnlessInWrapper();
|
||||
}
|
||||
}
|
||||
|
||||
QBindable<int> QPauseAnimation::bindableDuration()
|
||||
|
@ -257,9 +257,11 @@ void QTimer::start()
|
||||
void QTimer::start(int msec)
|
||||
{
|
||||
Q_D(QTimer);
|
||||
const bool intervalChanged = msec != d->inter;
|
||||
d->inter.setValue(msec);
|
||||
start();
|
||||
d->inter.notify();
|
||||
if (intervalChanged)
|
||||
d->inter.notify();
|
||||
}
|
||||
|
||||
|
||||
@ -753,6 +755,7 @@ QBindable<bool> QTimer::bindableSingleShot()
|
||||
void QTimer::setInterval(int msec)
|
||||
{
|
||||
Q_D(QTimer);
|
||||
const bool intervalChanged = msec != d->inter;
|
||||
d->inter.setValue(msec);
|
||||
if (d->id != INV_TIMER) { // create new timer
|
||||
QObject::killTimer(d->id); // restart timer
|
||||
@ -761,7 +764,8 @@ void QTimer::setInterval(int msec)
|
||||
// as timer state actually does not change
|
||||
}
|
||||
|
||||
d->inter.markDirty();
|
||||
if (intervalChanged)
|
||||
d->inter.markDirty();
|
||||
}
|
||||
|
||||
int QTimer::interval() const
|
||||
|
@ -929,8 +929,12 @@ void QMovie::setSpeed(int percentSpeed)
|
||||
Q_D(QMovie);
|
||||
if (!d->speed && d->movieState == Running)
|
||||
d->nextImageTimer.start(nextFrameDelay());
|
||||
d->speed.setValue(percentSpeed);
|
||||
d->speed.notify();
|
||||
if (percentSpeed != d->speed) {
|
||||
d->speed = percentSpeed;
|
||||
d->speed.notify();
|
||||
} else {
|
||||
d->speed.removeBindingUnlessInWrapper();
|
||||
}
|
||||
}
|
||||
|
||||
int QMovie::speed() const
|
||||
|
Loading…
Reference in New Issue
Block a user