diff options
author | Fabian Kosmale <fabian.kosmale@qt.io> | 2020-07-22 14:21:44 +0200 |
---|---|---|
committer | Fabian Kosmale <fabian.kosmale@qt.io> | 2020-08-12 15:52:09 +0200 |
commit | 26884a4f34cfe6bc10daa19f2096aa49ed0a31f2 (patch) | |
tree | 89ff368fc7efddef9d314d38ab71c92c9c6aef0f /src/qml/qml/qqmlpropertybinding.cpp | |
parent | 73066b77f2cd840b50220436e4e766bf380daa7a (diff) |
QQmlPropertyBinding: use QMetaType::equals for comparison
Change-Id: I5f36e9543a32e7d271a5a4217ea3b55cc03bea32
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/qml/qml/qqmlpropertybinding.cpp')
-rw-r--r-- | src/qml/qml/qqmlpropertybinding.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/qml/qml/qqmlpropertybinding.cpp b/src/qml/qml/qqmlpropertybinding.cpp index dc90848efb..6b82614e6d 100644 --- a/src/qml/qml/qqmlpropertybinding.cpp +++ b/src/qml/qml/qqmlpropertybinding.cpp @@ -111,10 +111,10 @@ bool QQmlPropertyBinding::evaluate(const QMetaType &metaType, void *dataPtr) QVariant resultVariant(scope.engine->toVariant(result, metaType.id())); auto metaTypeId = metaType.id(); resultVariant.convert(metaTypeId); + const bool hasChanged = !metaType.equals(resultVariant.constData(), dataPtr); QMetaType::destruct(metaTypeId, dataPtr); QMetaType::construct(metaTypeId, dataPtr, resultVariant.constData()); - // ### Fixme: Compare old and new values as soon as QMetaType has support for it - return true; + return hasChanged; } QUntypedPropertyBinding QQmlTranslationPropertyBinding::create(const QQmlPropertyData *pd, const QQmlRefPointer<QV4::ExecutableCompilationUnit> &compilationUnit, const QV4::CompiledData::Binding *binding) @@ -127,10 +127,10 @@ QUntypedPropertyBinding QQmlTranslationPropertyBinding::create(const QQmlPropert if (metaType.id() != QMetaType::QString) resultVariant.convert(metaType.id()); + const bool hasChanged = !metaType.equals(resultVariant.constData(), dataPtr); QMetaType::destruct(metaType.id(), dataPtr); QMetaType::construct(metaType.id(), dataPtr, resultVariant.constData()); - // ### Fixme: Compare old and new values as soon as QMetaType has support for it - return true; + return hasChanged; }; return QUntypedPropertyBinding(QMetaType(pd->propType()), translationBinding, QPropertyBindingSourceLocation()); |