From 124590850b7017233e25366688715ef642c5cdc3 Mon Sep 17 00:00:00 2001 From: Volker Hilsheimer Date: Wed, 15 Jul 2020 14:17:35 +0200 Subject: Don't test for equality if types can't be compared For types that don't have an operator==(), always trigger the binding and the changed notification. Task-number: QTBUG-85578 Change-Id: I41374f6d13c88106f4de83864e82172f3a248150 Reviewed-by: Fabian Kosmale --- src/corelib/kernel/qproperty.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/corelib/kernel/qproperty.h') diff --git a/src/corelib/kernel/qproperty.h b/src/corelib/kernel/qproperty.h index 5d26c1c0f4..c2949c3022 100644 --- a/src/corelib/kernel/qproperty.h +++ b/src/corelib/kernel/qproperty.h @@ -155,8 +155,10 @@ class QPropertyBinding : public QUntypedPropertyBinding { PropertyType *propertyPtr = static_cast(dataPtr); PropertyType newValue = impl(); - if (newValue == *propertyPtr) - return false; + if constexpr (QTypeTraits::has_operator_equal_v) { + if (newValue == *propertyPtr) + return false; + } *propertyPtr = std::move(newValue); return true; } -- cgit v1.2.3