diff options
authorJan Arve Saether <>2015-02-03 14:54:52 +0100
committerOswald Buddenhagen <>2015-02-05 14:27:22 +0000
commit49af548abb03743eabb8727ac685e1c290cb2118 (patch)
parent1043bf202bb848f8286f2c67ed2b8760fe9da8da (diff)
Fix regression from Qt4 with layout direction
In Qt4, if the result of the translation QApplication::translate("QT_LAYOUT_DIRECTION") returned "RTL", Qt usually called QApplication::setLayoutDirection(Qt::RightToLeft) in order for a translation file to specify if the UI should be left-to-right or right-to-left. However, due to modularization, we could no longer call QApplication::translate(), so the code was wrongly changed to call QCoreApplication::translate(....) instead. This was wrong, and in addition the translation files was never updated with the new context. This patch fixes it to only translate it with the QGuiApplication context. This is the only sensible context, since QApplication would lack QtQuick support, and QCoreApplication would not know how to change layout direction. [ChangeLog][QtGui][i18n] Fixed bug where layout direction did not switch according to the instruction in the translation file. Task-number: QTBUG-43447 Change-Id: Id0409a42d41b3b9ff1cd53d090c4d9c9802f5659 Reviewed-by: Oswald Buddenhagen <>
2 files changed, 2 insertions, 2 deletions
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp
index 23deb2c4b2..d44a79b37e 100644
--- a/src/gui/kernel/qguiapplication.cpp
+++ b/src/gui/kernel/qguiapplication.cpp
@@ -179,7 +179,7 @@ extern void qInitImageConversions();
static bool qt_detectRTLLanguage()
return force_reverse ^
- (QCoreApplication::tr("QT_LAYOUT_DIRECTION",
+ (QGuiApplication::tr("QT_LAYOUT_DIRECTION",
"Translate this string to the string 'LTR' in left-to-right"
" languages or to 'RTL' in right-to-left languages (such as Hebrew"
" and Arabic) to get proper widget layout.") == QLatin1String("RTL"));
diff --git a/tests/auto/other/languagechange/tst_languagechange.cpp b/tests/auto/other/languagechange/tst_languagechange.cpp
index 7b71231382..caf000a418 100644
--- a/tests/auto/other/languagechange/tst_languagechange.cpp
+++ b/tests/auto/other/languagechange/tst_languagechange.cpp
@@ -243,7 +243,7 @@ void tst_languageChange::retranslatability()
QSKIP("The input data are not suitable for this layout (QDialogButtonBox::GnomeLayout)");
// This will always be queried for when a language changes
- expected.insert("QCoreApplication::QT_LAYOUT_DIRECTION::Translate this string to the string 'LTR' in left-to-right "
+ expected.insert("QGuiApplication::QT_LAYOUT_DIRECTION::Translate this string to the string 'LTR' in left-to-right "
"languages or to 'RTL' in right-to-left languages (such as Hebrew and Arabic) to "
"get proper widget layout.");