diff options
author | Lars Knoll <lars.knoll@digia.com> | 2013-09-14 11:25:02 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-09-18 13:14:13 +0200 |
commit | f79df5da0769836bc866b470cdac43d6363dc7db (patch) | |
tree | 28deb1584b6c43dca92b39328bcf43099a92fcd6 /src/qml/qml/qqmllocale.cpp | |
parent | e4e90923c93adfafb23c81be7359e8df2a500b4f (diff) |
Convert more methods to return a Returned<>
Change-Id: If294c9c4f574824c308b63a11da1337226180105
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/qml/qqmllocale.cpp')
-rw-r--r-- | src/qml/qml/qqmllocale.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/qml/qml/qqmllocale.cpp b/src/qml/qml/qqmllocale.cpp index 5dcc807ab0..5e7116e271 100644 --- a/src/qml/qml/qqmllocale.cpp +++ b/src/qml/qml/qqmllocale.cpp @@ -519,10 +519,11 @@ QV4::ReturnedValue QQmlLocaleData::method_get_textDirection(QV4::SimpleCallConte QV4::ReturnedValue QQmlLocaleData::method_get_weekDays(QV4::SimpleCallContext *ctx) { + QV4::Scope scope(ctx); QLocale locale = getThisLocale(ctx); QList<Qt::DayOfWeek> days = locale.weekdays(); - QV4::ArrayObject *result = ctx->engine->newArrayObject(); + QV4::Scoped<QV4::ArrayObject> result(scope, ctx->engine->newArrayObject()); result->arrayReserve(days.size()); result->arrayDataLen = days.size(); for (int i = 0; i < days.size(); ++i) { @@ -533,21 +534,22 @@ QV4::ReturnedValue QQmlLocaleData::method_get_weekDays(QV4::SimpleCallContext *c } result->setArrayLengthUnchecked(days.size()); - return QV4::Value::fromObject(result).asReturnedValue(); + return result.asReturnedValue(); } QV4::ReturnedValue QQmlLocaleData::method_get_uiLanguages(QV4::SimpleCallContext *ctx) { + QV4::Scope scope(ctx); QLocale locale = getThisLocale(ctx); QStringList langs = locale.uiLanguages(); - QV4::ArrayObject *result = ctx->engine->newArrayObject(); + QV4::Scoped<QV4::ArrayObject> result(scope, ctx->engine->newArrayObject()); result->arrayReserve(langs.size()); result->arrayDataLen = langs.size(); for (int i = 0; i < langs.size(); ++i) result->arrayData[i].value = QV4::Value::fromString(ctx, langs.at(i)); result->setArrayLengthUnchecked(langs.size()); - return QV4::Value::fromObject(result).asReturnedValue(); + return result.asReturnedValue(); } QV4::ReturnedValue QQmlLocaleData::method_currencySymbol(QV4::SimpleCallContext *ctx) |