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>
This commit is contained in:
parent
10bf3ae90c
commit
c88905f0a9
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user