diff options
author | Simon Hausmann <simon.hausmann@qt.io> | 2020-01-22 13:37:48 +0100 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@qt.io> | 2020-01-23 15:56:40 +0100 |
commit | 020a6e67766595351bcf911e965b26952a7c81b8 (patch) | |
tree | 6cbb9340cb28f18efa98c9395b782cd13b81f101 /src/qml/jsruntime/qv4engine.cpp | |
parent | aca7b33368655949d238a0cdfc0073b6b8532872 (diff) |
Add Qt.uiLanguage and QJSEngine::uiLanguage properties
[ChangeLog][QtQml] Added Qt.uiLanguage and QJSEngine::uiLanguage properties
These properties mirror the same value in QML and C++ and can be used
freely. They also provide API symmetry to Qt for MCUs.
QQmlApplicationEngine binds to this property and applies translations
accordingly by constructing a QLocale with the value and using
QTranslator::load(locale).
Change-Id: Id87d6ee64679b07ff3cb47844594e8eeebd8c8b6
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Christian Kamm <mail@ckamm.de>
Diffstat (limited to 'src/qml/jsruntime/qv4engine.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4engine.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/qml/jsruntime/qv4engine.cpp b/src/qml/jsruntime/qv4engine.cpp index dcdebfb398..86e178d568 100644 --- a/src/qml/jsruntime/qv4engine.cpp +++ b/src/qml/jsruntime/qv4engine.cpp @@ -1949,11 +1949,12 @@ void ExecutionEngine::initQmlGlobalObject() void ExecutionEngine::initializeGlobal() { QV4::Scope scope(this); - QV4::GlobalExtensions::init(globalObject, QJSEngine::AllExtensions); QV4::ScopedObject qt(scope, memoryManager->allocate<QV4::QtObject>(qmlEngine())); globalObject->defineDefaultProperty(QStringLiteral("Qt"), qt); + QV4::GlobalExtensions::init(globalObject, QJSEngine::AllExtensions); + #if QT_CONFIG(qml_locale) QQmlLocale::registerStringLocaleCompare(this); QQmlDateExtension::registerExtension(this); |