summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel
diff options
context:
space:
mode:
authorFabian Kosmale <fabian.kosmale@qt.io>2021-02-03 12:02:29 +0100
committerFabian Kosmale <fabian.kosmale@qt.io>2021-04-01 10:04:27 +0200
commit2ffb91ac592d69adf9458ac45074174537435918 (patch)
treef9a6873e1c735c795fe55ac4cbae90c6a633eac2 /src/corelib/kernel
parentaa84de1afa78cf4b63239b35a4b65f1c9c4eab6c (diff)
QObjectCompatProperty: Require explicit notify
For QObjectCompatProperty, which allows to do basically anything in its setter, it is actually easier to manually specify when the change should become visible. This is in line with manually writing emit calls in the old property system, and allows the preservation of class invariants. Change-Id: I585bd3f25d722ca3fd721ead85fe73dbee26c5f6 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'src/corelib/kernel')
-rw-r--r--src/corelib/kernel/qproperty_p.h5
-rw-r--r--src/corelib/kernel/qtimer.cpp9
2 files changed, 3 insertions, 11 deletions
diff --git a/src/corelib/kernel/qproperty_p.h b/src/corelib/kernel/qproperty_p.h
index d1f4c5acba..a355a7faea 100644
--- a/src/corelib/kernel/qproperty_p.h
+++ b/src/corelib/kernel/qproperty_p.h
@@ -467,12 +467,7 @@ public:
const bool inWrapper = inBindingWrapper(storage);
if (bd && !inWrapper)
bd->removeBinding();
- if constexpr (QTypeTraits::has_operator_equal_v<T>)
- if (this->val == t)
- return;
this->val = t;
- if (!inWrapper)
- notify(bd);
}
QPropertyBinding<T> setBinding(const QPropertyBinding<T> &newBinding)
diff --git a/src/corelib/kernel/qtimer.cpp b/src/corelib/kernel/qtimer.cpp
index 49c57cb6ee..0946e1af48 100644
--- a/src/corelib/kernel/qtimer.cpp
+++ b/src/corelib/kernel/qtimer.cpp
@@ -257,10 +257,9 @@ void QTimer::start()
void QTimer::start(int msec)
{
Q_D(QTimer);
- d->inter.removeBindingUnlessInWrapper();
- d->inter.setValueBypassingBindings(msec);
+ d->inter.setValue(msec);
start();
- d->inter.markDirty();
+ d->inter.notify();
}
@@ -754,9 +753,7 @@ QBindable<bool> QTimer::bindableSingleShot()
void QTimer::setInterval(int msec)
{
Q_D(QTimer);
- d->inter.removeBindingUnlessInWrapper();
-
- d->inter.setValueBypassingBindings(msec);
+ d->inter.setValue(msec);
if (d->id != INV_TIMER) { // create new timer
QObject::killTimer(d->id); // restart timer
d->id = QObject::startTimer(msec, d->type);