summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel/qproperty.h
diff options
context:
space:
mode:
authorVolker Hilsheimer <volker.hilsheimer@qt.io>2020-07-15 14:17:35 +0200
committerVolker Hilsheimer <volker.hilsheimer@qt.io>2020-07-15 16:16:53 +0200
commit124590850b7017233e25366688715ef642c5cdc3 (patch)
tree0d8e3b2f0a32ad65c415bb70c0c83e7bb7cb5482 /src/corelib/kernel/qproperty.h
parent5f3f23462e7990800b7d93daecd4ab8e895ef036 (diff)
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 <fabian.kosmale@qt.io>
Diffstat (limited to 'src/corelib/kernel/qproperty.h')
-rw-r--r--src/corelib/kernel/qproperty.h6
1 files changed, 4 insertions, 2 deletions
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<PropertyType *>(dataPtr);
PropertyType newValue = impl();
- if (newValue == *propertyPtr)
- return false;
+ if constexpr (QTypeTraits::has_operator_equal_v<PropertyType>) {
+ if (newValue == *propertyPtr)
+ return false;
+ }
*propertyPtr = std::move(newValue);
return true;
}