summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2016-09-07 09:34:09 (GMT)
committerTobias Markmann <tm@ayena.de>2016-09-07 09:34:09 (GMT)
commitb54df5d2a50d4dda0e63ac06050d4ed306952dbb (patch)
treece6f30d64fb102e41a641467b3a5ebce1974ec18 /Swift/QtUI/main.cpp
parentdfee5070225e9f2d5e0612cb65ce504b0700d0b9 (diff)
downloadswift-b54df5d2a50d4dda0e63ac06050d4ed306952dbb.zip
swift-b54df5d2a50d4dda0e63ac06050d4ed306952dbb.tar.bz2
Explicitly set layout direction based on QT_LAYOUT_DIRECTION
This is supposed to happen automatically according to Qt documentation but it does not. Qt also changed the context of QT_LAYOUT_DIRECTION from Application to QGuiApplication. This commit adjusts our translations accordingly. Test-Information: Tested with Qt 5.4.2 and Qt 5.5.1 on OS X 10.11.6 with German and Hebrew translations. Change-Id: I0b6a8bf35487e95f5186fd4fa09d4dcb92ba0c01
Diffstat (limited to 'Swift/QtUI/main.cpp')
-rw-r--r--Swift/QtUI/main.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/Swift/QtUI/main.cpp b/Swift/QtUI/main.cpp
index 4850b49..472c99a 100644
--- a/Swift/QtUI/main.cpp
+++ b/Swift/QtUI/main.cpp
@@ -107,6 +107,14 @@ int main(int argc, char* argv[]) {
QtTranslator swiftTranslator;
Swift::Translator::setInstance(&swiftTranslator);
+#if QT_VERSION < 0x050501
+ /* According to Qt documenation, Qt is suppsoed to set the applications layout
+ * direction based on the translatable QT_LAYOUT_DIRECTION string. There is a
+ * bug in Qt prior version 5.5.1, i.e. QTBUG-43447, thus we set the layout
+ * direction manually based on the tranlsated QT_LAYOUT_DIRECTION string.
+ */
+ app.setLayoutDirection(QGuiApplication::tr("QT_LAYOUT_DIRECTION") == QLatin1String("RTL") ? Qt::RightToLeft : Qt::LeftToRight);
+#endif
Swift::QtSwift swift(vm);
int result = app.exec();