diff options
author | Lars Knoll <lars.knoll@digia.com> | 2013-09-23 15:52:10 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-09-26 09:05:16 +0200 |
commit | 12fd2ccd3fa2dc0133b5a3fb89f9fdf5cf721232 (patch) | |
tree | 880acb9c7c0d8289185b6aebe4339f439c707a0e /src/qml/qml/qqmlproperty.cpp | |
parent | 2e4f66caa8a5f9e887dbdb4e3f2ae5c9be9a7005 (diff) |
Fix Persistent/WeakValue API
Don't use unprotected Values in the API anymore.
Change-Id: I8851628227fca374de24701bc8ee0908b5ae3923
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/qml/qqmlproperty.cpp')
-rw-r--r-- | src/qml/qml/qqmlproperty.cpp | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/src/qml/qml/qqmlproperty.cpp b/src/qml/qml/qqmlproperty.cpp index f821687f63..bcecda9c57 100644 --- a/src/qml/qml/qqmlproperty.cpp +++ b/src/qml/qml/qqmlproperty.cpp @@ -1460,7 +1460,7 @@ bool QQmlPropertyPrivate::writeBinding(QObject *object, const QQmlPropertyData &core, QQmlContextData *context, QQmlJavaScriptExpression *expression, - const QV4::Value &result, bool isUndefined, + const QV4::ValueRef result, bool isUndefined, WriteFlags flags) { Q_ASSERT(object); @@ -1482,22 +1482,22 @@ bool QQmlPropertyPrivate::writeBinding(QObject *object, if (!isUndefined && !core.isValueTypeVirtual()) { switch (core.propType) { case QMetaType::Int: - if (result.isInteger()) - QUICK_STORE(int, result.integerValue()) - else if (result.isNumber()) - QUICK_STORE(int, qRound(result.doubleValue())) + if (result->isInteger()) + QUICK_STORE(int, result->integerValue()) + else if (result->isNumber()) + QUICK_STORE(int, qRound(result->doubleValue())) break; case QMetaType::Double: - if (result.isNumber()) - QUICK_STORE(double, result.asDouble()) + if (result->isNumber()) + QUICK_STORE(double, result->asDouble()) break; case QMetaType::Float: - if (result.isNumber()) - QUICK_STORE(float, result.asDouble()) + if (result->isNumber()) + QUICK_STORE(float, result->asDouble()) break; case QMetaType::QString: - if (result.isString()) - QUICK_STORE(QString, result.toQStringNoThrow()) + if (result->isString()) + QUICK_STORE(QString, result->toQStringNoThrow()) break; default: break; @@ -1514,19 +1514,19 @@ bool QQmlPropertyPrivate::writeBinding(QObject *object, if (isUndefined) { } else if (core.isQList()) { - value = v8engine->toVariant(result, qMetaTypeId<QList<QObject *> >()); - } else if (result.isNull() && core.isQObject()) { + value = v8engine->toVariant(*result, qMetaTypeId<QList<QObject *> >()); + } else if (result->isNull() && core.isQObject()) { value = QVariant::fromValue((QObject *)0); } else if (core.propType == qMetaTypeId<QList<QUrl> >()) { - value = resolvedUrlSequence(v8engine->toVariant(result, qMetaTypeId<QList<QUrl> >()), context); + value = resolvedUrlSequence(v8engine->toVariant(*result, qMetaTypeId<QList<QUrl> >()), context); } else if (!isVarProperty && type != qMetaTypeId<QJSValue>()) { - value = v8engine->toVariant(result, type); + value = v8engine->toVariant(*result, type); } if (expression->hasError()) { return false; } else if (isVarProperty) { - QV4::FunctionObject *f = result.asFunctionObject(); + QV4::FunctionObject *f = result->asFunctionObject(); if (f && f->bindingKeyFlag) { // we explicitly disallow this case to avoid confusion. Users can still store one // in an array in a var property if they need to, but the common case is user error. @@ -1537,14 +1537,14 @@ bool QQmlPropertyPrivate::writeBinding(QObject *object, QQmlVMEMetaObject *vmemo = QQmlVMEMetaObject::get(object); Q_ASSERT(vmemo); - vmemo->setVMEProperty(core.coreIndex, result); + vmemo->setVMEProperty(core.coreIndex, *result); } else if (isUndefined && core.isResettable()) { void *args[] = { 0 }; QMetaObject::metacall(object, QMetaObject::ResetProperty, core.coreIndex, args); } else if (isUndefined && type == qMetaTypeId<QVariant>()) { writeValueProperty(object, core, QVariant(), context, flags); } else if (type == qMetaTypeId<QJSValue>()) { - QV4::FunctionObject *f = result.asFunctionObject(); + QV4::FunctionObject *f = result->asFunctionObject(); if (f && f->bindingKeyFlag) { expression->delayedError()->setErrorDescription(QLatin1String("Invalid use of Qt.binding() in a binding declaration.")); expression->delayedError()->setErrorObject(object); @@ -1562,7 +1562,7 @@ bool QQmlPropertyPrivate::writeBinding(QObject *object, expression->delayedError()->setErrorDescription(errorStr); expression->delayedError()->setErrorObject(object); return false; - } else if (QV4::FunctionObject *f = result.asFunctionObject()) { + } else if (QV4::FunctionObject *f = result->asFunctionObject()) { if (f->bindingKeyFlag) expression->delayedError()->setErrorDescription(QLatin1String("Invalid use of Qt.binding() in a binding declaration.")); else |