summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorFabian Kosmale <fabian.kosmale@qt.io>2020-12-16 15:34:22 +0100
committerFabian Kosmale <fabian.kosmale@qt.io>2020-12-18 13:10:46 +0100
commitc88905f0a947d59c61d9f0f990354ca935d3d4ed (patch)
tree883608eece7cb7cd5d5c9debb4b5318ae3f74742 /src
parent10bf3ae90cadbec44c6007190bf16e3c9c7652d8 (diff)
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 <lars.knoll@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/corelib/kernel/qproperty.h6
1 files changed, 1 insertions, 5 deletions
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<PropertyType>(), &QtPrivate::bindingFunctionVTable<std::remove_reference_t<Functor>, PropertyType>, &f, location)
{}
- template<typename Property, typename = typename Property::InheritsQUntypedPropertyData>
- QPropertyBinding(const Property &property)
- : QUntypedPropertyBinding(property.bindingData().binding())
- {}
// Internal
explicit QPropertyBinding(const QUntypedPropertyBinding &binding)
@@ -428,7 +424,7 @@ public:
QPropertyBinding<T> binding() const
{
- return QPropertyBinding<T>(*this);
+ return QPropertyBinding<T>(QUntypedPropertyBinding(d.binding()));
}
QPropertyBinding<T> takeBinding()