diff options
author | Lars Knoll <lars.knoll@qt.io> | 2020-08-17 15:04:58 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2020-09-02 22:44:28 +0200 |
commit | 638df6138e7acecc2d3b6aad0771e2d81355f2d2 (patch) | |
tree | 22cb09b23d186ef0d4164cea4b124894cebb3996 /src/corelib/kernel/qproperty.h | |
parent | ee96d705ccfe5c27a24b63100b8352987dbb0ae4 (diff) |
Remove operators allowing assignment of a binding to a property
These look rather weird, an explicit property.setBinding() call
is simply better in this case, and also more aligned with the API
we can offer in QObject.
Change-Id: Ifb00fd47a75e6b3bc94e34bf49e4f13249565bfe
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'src/corelib/kernel/qproperty.h')
-rw-r--r-- | src/corelib/kernel/qproperty.h | 33 |
1 files changed, 9 insertions, 24 deletions
diff --git a/src/corelib/kernel/qproperty.h b/src/corelib/kernel/qproperty.h index 02d1c1eb94..1f45caee49 100644 --- a/src/corelib/kernel/qproperty.h +++ b/src/corelib/kernel/qproperty.h @@ -316,13 +316,9 @@ public: explicit QProperty(parameter_type initialValue) : QPropertyData<T>(initialValue) {} explicit QProperty(rvalue_ref initialValue) : QPropertyData<T>(std::move(initialValue)) {} QProperty(QProperty &&other) : QPropertyData<T>(std::move(other.val)), d(std::move(other.d), this) { notify(); } - QProperty &operator=(QProperty &&other) { this->val = std::move(other.val); d.moveAssign(std::move(other.d), this); notify(); return *this; } - QProperty(const QPropertyBinding<T> &binding) + explicit QProperty(const QPropertyBinding<T> &binding) : QProperty() - { operator=(binding); } - QProperty(QPropertyBinding<T> &&binding) - : QProperty() - { operator=(std::move(binding)); } + { setBinding(binding); } #ifndef Q_CLANG_QDOC template <typename Functor> explicit QProperty(Functor &&f, const QPropertyBindingSourceLocation &location = QT_PROPERTY_DEFAULT_BINDING_LOCATION, @@ -333,6 +329,13 @@ public: template <typename Functor> explicit QProperty(Functor &&f); #endif + QProperty &operator=(QProperty &&other) + { + this->val = std::move(other.val); + d.moveAssign(std::move(other.d), this); + notify(); + return *this; + } ~QProperty() = default; parameter_type value() const @@ -395,12 +398,6 @@ public: return *this; } - QProperty<T> &operator=(const QPropertyBinding<T> &newBinding) - { - setBinding(newBinding); - return *this; - } - QPropertyBinding<T> setBinding(const QPropertyBinding<T> &newBinding) { QPropertyBinding<T> oldBinding(d.setBinding(newBinding, this)); @@ -532,18 +529,6 @@ public: return *this; } - QPropertyAlias<T> &operator=(const QPropertyBinding<T> &newBinding) - { - setBinding(newBinding); - return *this; - } - - QPropertyAlias<T> &operator=(QPropertyBinding<T> &&newBinding) - { - setBinding(std::move(newBinding)); - return *this; - } - QPropertyBinding<T> setBinding(const QPropertyBinding<T> &newBinding) { if (auto *p = aliasedProperty()) |