diff options
author | Fabian Kosmale <fabian.kosmale@qt.io> | 2021-10-07 14:22:14 +0200 |
---|---|---|
committer | Fabian Kosmale <fabian.kosmale@qt.io> | 2021-10-07 22:28:29 +0200 |
commit | d39efefe0d36a7da766246363788fc4d0c9971bf (patch) | |
tree | 94f0c5777cacf9ed95f053660b817f3ce73c6cc9 /src/qml/jsapi/qjsengine_p.h | |
parent | c96c49bcedfeb4ea47044a2cc877a2763ddd17fe (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_p.h')
-rw-r--r-- | src/qml/jsapi/qjsengine_p.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/qml/jsapi/qjsengine_p.h b/src/qml/jsapi/qjsengine_p.h index cd3a740d19..e3d7f7adb2 100644 --- a/src/qml/jsapi/qjsengine_p.h +++ b/src/qml/jsapi/qjsengine_p.h @@ -83,8 +83,8 @@ public: // Shared by QQmlEngine mutable QRecursiveMutex mutex; - - QProperty<QString> uiLanguage; + void uiLanguageChanged() { Q_Q(QJSEngine); if (q) q->uiLanguageChanged(); } + Q_OBJECT_BINDABLE_PROPERTY(QJSEnginePrivate, QString, uiLanguage, &QJSEnginePrivate::uiLanguageChanged); // These methods may be called from the QML loader thread inline QQmlPropertyCache *cache(QObject *obj, QTypeRevision version = QTypeRevision(), bool doRef = false); |