diff options
author | Andy Shaw <andy.shaw@qt.io> | 2020-02-13 15:33:00 +0100 |
---|---|---|
committer | Andy Shaw <andy.shaw@qt.io> | 2020-02-18 22:11:30 +0100 |
commit | 9029c5586460950b4fa6773a5d08c67e5ba16e8a (patch) | |
tree | 21b0e8ec660dcab699fff06b0251a13289d5684a /src/gui/kernel | |
parent | 274b6f3c1323a237d04520daacb7212c89d1cb13 (diff) |
Send the LanguageChange event to all top level windows, not just widgets
By sending it to all top level windows it will make it possible for
non widget based controls to listen for this event if it cares about it
so it can handle translation updates as appropriate.
Task-number: QTBUG-78141
Task-number: QTBUG-82020
Change-Id: I8f35cdcccd81a199ff780c3f4f3d2c663480d638
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src/gui/kernel')
-rw-r--r-- | src/gui/kernel/qguiapplication.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index 67b1ed15c5..bbcb7d9cc5 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -1882,6 +1882,10 @@ bool QGuiApplication::event(QEvent *e) { if(e->type() == QEvent::LanguageChange) { setLayoutDirection(qt_detectRTLLanguage()?Qt::RightToLeft:Qt::LeftToRight); + for (auto *topLevelWindow : QGuiApplication::topLevelWindows()) { + if (topLevelWindow->flags() != Qt::Desktop) + postEvent(topLevelWindow, new QEvent(QEvent::LanguageChange)); + } } else if (e->type() == QEvent::Quit) { // Close open windows. This is done in order to deliver de-expose // events while the event loop is still running. |