diff options
author | Fabian Kosmale <fabian.kosmale@qt.io> | 2020-07-15 14:12:58 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2020-09-02 22:44:27 +0200 |
commit | 733d890430542e907b9014a2cf73d63edf931245 (patch) | |
tree | 470dd4321b748c0de57b182617950321b7f22731 /src/corelib/kernel/qpropertyprivate.h | |
parent | 52bbb19fa4dc7647a0cad35a69dcf09437386080 (diff) |
Add operator-> and operator*() to QProperty
Enable the arrow operator for all types that could have members, so
that one can e.g. write myStringProperty->size() instead of having to
use the less convenient myStringProperty.value().size().
Also cleaned up the rvalue ref overloads to be
disabled for basic types. For those we now also
return by value, for more complex types we
return a const reference.
Change-Id: If6a75898dc0a097f57052488f0af0cd7166b3393
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'src/corelib/kernel/qpropertyprivate.h')
-rw-r--r-- | src/corelib/kernel/qpropertyprivate.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/corelib/kernel/qpropertyprivate.h b/src/corelib/kernel/qpropertyprivate.h index d5ee9f29c2..4d8a457e32 100644 --- a/src/corelib/kernel/qpropertyprivate.h +++ b/src/corelib/kernel/qpropertyprivate.h @@ -136,7 +136,7 @@ public: 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 getValue() const { return value; } + T const& getValue() const { return value; } bool setValueAndReturnTrueIfChanged(T &&v) { if constexpr (QTypeTraits::has_operator_equal_v<T>) { |