diff options
author | Simon Hausmann <simon.hausmann@qt.io> | 2020-04-14 14:38:13 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2020-04-22 10:21:44 +0200 |
commit | 0293ea29918ecf1ddd69709e5dad629af59d7aa8 (patch) | |
tree | 97deb6994fb94d0ba931bccc493ef152c3991687 /src/qml/qml/qqmlpropertybinding.cpp | |
parent | d4edf441257b7e5782a6c25802d821647ffcba45 (diff) |
Update dependencies.yaml and adapt to API changes in qtbase
The evaluation callback does not have to perform the comparison anymore
and the shared pointer of the private is not used in the API anymore.
Also, the versionFunctions() has been moved out of QOpenGLContext
and renamed QOpenGLVersionFunctionsFactory::get().
QHash doesn't keep iterators stable under erase(), so clean up
the code relying on it, and avoid an intermediate QList at the
same time.
Task-number: QTBUG-74409
Change-Id: I90176be1067d88c8f2b1ea07198a06d432f5be9c
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Diffstat (limited to 'src/qml/qml/qqmlpropertybinding.cpp')
-rw-r--r-- | src/qml/qml/qqmlpropertybinding.cpp | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/src/qml/qml/qqmlpropertybinding.cpp b/src/qml/qml/qqmlpropertybinding.cpp index e005635fad..c7f620c88c 100644 --- a/src/qml/qml/qqmlpropertybinding.cpp +++ b/src/qml/qml/qqmlpropertybinding.cpp @@ -67,7 +67,7 @@ QUntypedPropertyBinding QQmlPropertyBinding::create(const QQmlPropertyData *pd, binding->setContext(ctxt); binding->setScopeObject(obj); binding->setupFunction(scope, function); - return QUntypedPropertyBinding(QPropertyBindingPrivatePtr(binding)); + return QUntypedPropertyBinding(QPropertyBindingPrivatePtr(binding).data()); } void QQmlPropertyBinding::expressionChanged() @@ -78,12 +78,12 @@ void QQmlPropertyBinding::expressionChanged() QQmlPropertyBinding::QQmlPropertyBinding(const QMetaType &mt) : QPropertyBindingPrivate(mt, [this](const QMetaType &metaType, void *dataPtr) -> QUntypedPropertyBinding::BindingEvaluationResult { - return evaluateAndReturnTrueIfChanged(metaType, dataPtr); + return evaluate(metaType, dataPtr); }, QPropertyBindingSourceLocation()) { } -QUntypedPropertyBinding::BindingEvaluationResult QQmlPropertyBinding::evaluateAndReturnTrueIfChanged(const QMetaType &metaType, void *dataPtr) +QUntypedPropertyBinding::BindingEvaluationResult QQmlPropertyBinding::evaluate(const QMetaType &metaType, void *dataPtr) { QQmlEngine *engine = context()->engine(); QQmlEnginePrivate *ep = QQmlEnginePrivate::get(engine); @@ -103,19 +103,14 @@ QUntypedPropertyBinding::BindingEvaluationResult QQmlPropertyBinding::evaluateAn } QVariant resultVariant(scope.engine->toVariant(result, metaType.id())); - - int compareResult = 0; - if (QMetaType::compare(dataPtr, resultVariant.constData(), metaType.id(), &compareResult) - && compareResult == 0) - return false; QMetaType::destruct(metaType.id(), dataPtr); QMetaType::construct(metaType.id(), dataPtr, resultVariant.constData()); - return true; + return QPropertyBindingError::NoError; } QUntypedPropertyBinding QQmlTranslationPropertyBinding::create(const QQmlPropertyData *pd, const QQmlRefPointer<QV4::ExecutableCompilationUnit> &compilationUnit, const QV4::CompiledData::Binding *binding) { - auto translationBinding = [compilationUnit, binding](const QMetaType &metaType, void *dataPtr) { + auto translationBinding = [compilationUnit, binding](const QMetaType &metaType, void *dataPtr) -> QUntypedPropertyBinding::BindingEvaluationResult { // Create a dependency to the uiLanguage QJSEnginePrivate::get(compilationUnit->engine)->uiLanguage.value(); @@ -123,13 +118,9 @@ QUntypedPropertyBinding QQmlTranslationPropertyBinding::create(const QQmlPropert if (metaType.id() != QMetaType::QString) resultVariant.convert(metaType.id()); - int compareResult = 0; - if (QMetaType::compare(dataPtr, resultVariant.constData(), metaType.id(), &compareResult) - && compareResult == 0) - return false; QMetaType::destruct(metaType.id(), dataPtr); QMetaType::construct(metaType.id(), dataPtr, resultVariant.constData()); - return true; + return QPropertyBindingError::NoError; }; return QUntypedPropertyBinding(QMetaType(pd->propType()), translationBinding, QPropertyBindingSourceLocation()); |