diff options
author | Fabian Kosmale <fabian.kosmale@qt.io> | 2023-04-19 14:57:13 +0200 |
---|---|---|
committer | Fabian Kosmale <fabian.kosmale@qt.io> | 2023-04-24 22:22:13 +0200 |
commit | 59567e25f6d4fbab3f0aecb5f0ff1c1978cce681 (patch) | |
tree | e066f50f0448de2aa38c22dd076f1d792cde3db6 /src/qml/qml/qqmlengine.h | |
parent | 7a3bd96a24ebb37ab3f6238fc2825120debbe003 (diff) |
QQmlEngine: Introduce markCurrentFunctionAsTranslationBinding
The general recommendation to handle language changes in QML is to
handle the LanguageChange event. However, if one is willing to tie
themselves to the QQmlEngine, we can offer a way to ensure that calling
a function will result in a traslation binding.
This might also be helpful for anyone implementing a translation system
different from Qt's, e.g. KDE's i18n.
Fixes: QTBUG-102393
Change-Id: Id4d7a401e0be9d65e1769c8471b26689f44bf66a
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'src/qml/qml/qqmlengine.h')
-rw-r--r-- | src/qml/qml/qqmlengine.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/qml/qml/qqmlengine.h b/src/qml/qml/qqmlengine.h index a8b19e41c6..9c20090613 100644 --- a/src/qml/qml/qqmlengine.h +++ b/src/qml/qml/qqmlengine.h @@ -123,6 +123,8 @@ public: bool outputWarningsToStandardError() const; void setOutputWarningsToStandardError(bool); + void markCurrentFunctionAsTranslationBinding(); + template<typename T> T singletonInstance(int qmlTypeId); |