From c88905f0a947d59c61d9f0f990354ca935d3d4ed Mon Sep 17 00:00:00 2001 From: Fabian Kosmale Date: Wed, 16 Dec 2020 15:34:22 +0100 Subject: Disallow construction of QPropertyBinding from a property This would steal an existing binding from a property, which is most likely not the intended action. Alternatively, we could make it equivalent to Qt::makePropertyBinding(foo), but that conflates properties with bindings to it. On the other hand, this would avoid a potentially source-breaking change. [ChangeLog][Potentially Source Breaking Change] It was possible to create a QPropertyBinding from a property; this would steal any set binding from the property or create an invalid binding if none was set. Use makePropertyBinding if you want to to create a binding which depends on the property's value, or takeBinding if you want to repurpose the property's binding. Fixes: QTBUG-89507 Pick-to: 6.0 Change-Id: Icd2d3b9261b60f36948f2cea9c33ddbea36efbc1 Reviewed-by: Lars Knoll --- src/corelib/kernel/qproperty.h | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'src') diff --git a/src/corelib/kernel/qproperty.h b/src/corelib/kernel/qproperty.h index 102b627d76..8fda7715c2 100644 --- a/src/corelib/kernel/qproperty.h +++ b/src/corelib/kernel/qproperty.h @@ -183,10 +183,6 @@ public: : QUntypedPropertyBinding(QMetaType::fromType(), &QtPrivate::bindingFunctionVTable, PropertyType>, &f, location) {} - template - QPropertyBinding(const Property &property) - : QUntypedPropertyBinding(property.bindingData().binding()) - {} // Internal explicit QPropertyBinding(const QUntypedPropertyBinding &binding) @@ -428,7 +424,7 @@ public: QPropertyBinding binding() const { - return QPropertyBinding(*this); + return QPropertyBinding(QUntypedPropertyBinding(d.binding())); } QPropertyBinding takeBinding() -- cgit v1.2.3