diff --git a/src/corelib/kernel/qproperty.h b/src/corelib/kernel/qproperty.h index c6be89e169..acaf74f9af 100644 --- a/src/corelib/kernel/qproperty.h +++ b/src/corelib/kernel/qproperty.h @@ -276,20 +276,11 @@ public: return oldBinding; } - QPropertyBinding setBinding(QPropertyBinding &&newBinding) - { - QPropertyBinding b(std::move(newBinding)); - QPropertyBinding oldBinding(d.priv.setBinding(b, &d)); - notify(); - return oldBinding; - } - bool setBinding(const QUntypedPropertyBinding &newBinding) { if (newBinding.valueMetaType().id() != qMetaTypeId()) return false; - d.priv.setBinding(newBinding, &d); - notify(); + setBinding(static_cast &>(newBinding)); return true; } @@ -461,41 +452,11 @@ public: } } - QPropertyBinding setBinding(Class *owner, QPropertyBinding &&newBinding) - { - QPropertyBinding b(std::move(newBinding)); - if constexpr (CallbackAcceptsOldValue) { - T oldValue = value(); - QPropertyBinding oldBinding(d.priv.setBinding(b, &d, owner, [](void *o, void *oldVal) { - (reinterpret_cast(o)->*Callback)(*reinterpret_cast(oldVal)); - }, GuardTE)); - notify(owner, &oldValue); - return oldBinding; - } else { - QPropertyBinding oldBinding(d.priv.setBinding(b, &d, owner, [](void *o, void *) { - (reinterpret_cast(o)->*Callback)(); - }, GuardTE)); - notify(owner); - return oldBinding; - } - } - bool setBinding(Class *owner, const QUntypedPropertyBinding &newBinding) { if (newBinding.valueMetaType().id() != qMetaTypeId()) return false; - if constexpr (CallbackAcceptsOldValue) { - T oldValue = value(); - d.priv.setBinding(newBinding, &d, owner, [](void *o, void *oldVal) { - (reinterpret_cast(o)->*Callback)(*reinterpret_cast(oldVal)); - }, GuardTE); - notify(owner, &oldValue); - } else { - d.priv.setBinding(newBinding, &d, owner, [](void *o, void *) { - (reinterpret_cast(o)->*Callback)(); - }, GuardTE); - notify(owner); - } + setBinding(owner, static_cast &>(newBinding)); return true; }