From 733d890430542e907b9014a2cf73d63edf931245 Mon Sep 17 00:00:00 2001 From: Fabian Kosmale Date: Wed, 15 Jul 2020 14:12:58 +0200 Subject: 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 --- src/corelib/kernel/qpropertyprivate.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/corelib/kernel/qpropertyprivate.h') 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) { -- cgit v1.2.3