Add method to conditionally remove binding to QObjectCompatProperty

Setters of QObjectCompatProperty need to remove the binding, but
only if it is not in the wrapper. This patch adds this method to
the public interface.

Change-Id: Ibc96418fe15b0aeeb2059411ea910ba1f733c255
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
This commit is contained in:
Andreas Buhr 2021-02-01 18:41:42 +01:00
parent 74f549b402
commit 52fcd0b6d7

View File

@ -504,6 +504,16 @@ public:
}
}
void removeBindingUnlessInWrapper()
{
QBindingStorage *storage = qGetBindingStorage(owner());
auto *bd = storage->bindingData(this);
// make sure we don't remove the binding if called from the bindingWrapper
const bool inWrapper = inBindingWrapper(storage);
if (bd && !inWrapper)
bd->removeBinding();
}
QPropertyBinding<T> binding() const
{
auto *bd = qGetBindingStorage(owner())->bindingData(this);