diff options
author | Fabian Kosmale <fabian.kosmale@qt.io> | 2020-12-16 15:34:22 +0100 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2020-12-18 14:19:28 +0000 |
commit | 597f0d9681f22f564d249b14d39b13221161ab53 (patch) | |
tree | 6418977dc982c2faff971298f52889a905651725 /src/corelib/kernel | |
parent | 3df49a4c5535df336ddfd970cdd9c646f83e43ea (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
Change-Id: Icd2d3b9261b60f36948f2cea9c33ddbea36efbc1
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
(cherry picked from commit c88905f0a947d59c61d9f0f990354ca935d3d4ed)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src/corelib/kernel')
-rw-r--r-- | src/corelib/kernel/qproperty.h | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/src/corelib/kernel/qproperty.h b/src/corelib/kernel/qproperty.h index b6653c0411..9c4c1cfa48 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) @@ -423,7 +419,7 @@ public: QPropertyBinding<T> binding() const { - return QPropertyBinding<T>(*this); + return QPropertyBinding<T>(QUntypedPropertyBinding(d.binding())); } QPropertyBinding<T> takeBinding() |