diff options
author | Lars Knoll <lars.knoll@qt.io> | 2020-08-12 12:23:16 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2020-09-02 22:44:27 +0200 |
commit | 0c89721716d9be43675358cbdb9c3170fd5936af (patch) | |
tree | fc76b8de2fa1b6a9f4d3c515a901badc01984c63 /src/corelib/kernel/qpropertyprivate.h | |
parent | 331c106bdbf12c6925c2c40f3813b71c65caf9a2 (diff) |
Get rid of QPropertyValueStorage
This simplifies and cleans up the code.
Change-Id: Ic811925d644466ff298f1109efcda0537e52ce0d
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/corelib/kernel/qpropertyprivate.h')
-rw-r--r-- | src/corelib/kernel/qpropertyprivate.h | 38 |
1 files changed, 0 insertions, 38 deletions
diff --git a/src/corelib/kernel/qpropertyprivate.h b/src/corelib/kernel/qpropertyprivate.h index fe6895d953..acdf405648 100644 --- a/src/corelib/kernel/qpropertyprivate.h +++ b/src/corelib/kernel/qpropertyprivate.h @@ -119,44 +119,6 @@ public: static const quintptr FlagMask = BindingBit | ExtraBit; }; -template <typename T> -struct QPropertyValueStorage -{ -private: - T value; -public: - QPropertyBase priv; - - QPropertyValueStorage() : value() {} - Q_DISABLE_COPY(QPropertyValueStorage) - explicit QPropertyValueStorage(const T &initialValue) : value(initialValue) {} - QPropertyValueStorage &operator=(const T &newValue) { value = newValue; return *this; } - explicit QPropertyValueStorage(T &&initialValue) : value(std::move(initialValue)) {} - QPropertyValueStorage &operator=(T &&newValue) { value = std::move(newValue); return *this; } - QPropertyValueStorage(QPropertyValueStorage &&other) : value(std::move(other.value)), priv(std::move(other.priv), this) {} - QPropertyValueStorage &operator=(QPropertyValueStorage &&other) { value = std::move(other.value); priv.moveAssign(std::move(other.priv), &value); return *this; } - - T const& getValue() const { return value; } - bool setValueAndReturnTrueIfChanged(T &&v) - { - if constexpr (QTypeTraits::has_operator_equal_v<T>) { - if (v == value) - return false; - } - value = std::move(v); - return true; - } - bool setValueAndReturnTrueIfChanged(const T &v) - { - if constexpr (QTypeTraits::has_operator_equal_v<T>) { - if (v == value) - return false; - } - value = v; - return true; - } -}; - template <typename T, typename Tag> class QTagPreservingPointerToPointer { |