aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsapi/qjsengine.cpp
diff options
context:
space:
mode:
authorFabian Kosmale <fabian.kosmale@qt.io>2021-10-07 14:22:14 +0200
committerFabian Kosmale <fabian.kosmale@qt.io>2021-10-07 22:28:29 +0200
commitd39efefe0d36a7da766246363788fc4d0c9971bf (patch)
tree94f0c5777cacf9ed95f053660b817f3ce73c6cc9 /src/qml/jsapi/qjsengine.cpp
parentc96c49bcedfeb4ea47044a2cc877a2763ddd17fe (diff)
QJSEngine: Make uiLanguage a QObjectBindableProperty
It was a plain QProperty before. Given that the property is exposed in the global Qt object in the engine, this could be problematic as with the QProperty it is possible to change the value without emitting the uiLanguageChanged signal. By using QObjectBindableProperty, we ensure that the signal is always emitted. Pick-to: 6.2 Change-Id: I0f771a4e4d752704f469de27617835260b261052 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'src/qml/jsapi/qjsengine.cpp')
-rw-r--r--src/qml/jsapi/qjsengine.cpp8
1 files changed, 2 insertions, 6 deletions
diff --git a/src/qml/jsapi/qjsengine.cpp b/src/qml/jsapi/qjsengine.cpp
index f67cff054c..1e102699f1 100644
--- a/src/qml/jsapi/qjsengine.cpp
+++ b/src/qml/jsapi/qjsengine.cpp
@@ -1105,13 +1105,9 @@ QJSValue QJSEngine::catchError()
after installing translators in your application. By convention, an empty string
means no translation from the language used in the source code is intended to occur.
*/
-void QJSEngine::setUiLanguage(const QString &language)
-{
+void QJSEngine::setUiLanguage(const QString &language) {
Q_D(QJSEngine);
- if (language == d->uiLanguage)
- return;
- d->uiLanguage = language;
- emit uiLanguageChanged();
+ d->uiLanguage = language; // property takes care of signal emission if necessary
}
QString QJSEngine::uiLanguage() const