From 0815332c732880db127b6c060381f4e13c6adc22 Mon Sep 17 00:00:00 2001 From: xavier Date: Mon, 20 Feb 2012 21:20:34 +0000 Subject: [PATCH] The application now uses right-to-left layouts when required by translations through a special, non-displayed translated string. git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/branches/0.3@1518 bfdf4180-ca20-0410-9c96-a3a8aa849046 --- sources/qetapp.cpp | 13 +++++++++++++ sources/qetapp.h | 1 + 2 files changed, 14 insertions(+) diff --git a/sources/qetapp.cpp b/sources/qetapp.cpp index 317fcf417..ba29319d7 100644 --- a/sources/qetapp.cpp +++ b/sources/qetapp.cpp @@ -168,6 +168,19 @@ void QETApp::setLanguage(const QString &desired_language) { } } installTranslator(&qetTranslator); + + QString ltr_special_string = tr( + "LTR", + "Translate this string to RTL if you are translating to a Right-to-Left language, else translate to LTR" + ); + if (ltr_special_string == "RTL") switchLayout(Qt::RightToLeft); +} + +/** + Switches the application to the provided layout. +*/ +void QETApp::switchLayout(Qt::LayoutDirection direction) { + setLayoutDirection(direction); } /** diff --git a/sources/qetapp.h b/sources/qetapp.h index bcd2e6720..82c9504f1 100644 --- a/sources/qetapp.h +++ b/sources/qetapp.h @@ -62,6 +62,7 @@ class QETApp : public QETSingleApplication { public: static QETApp *instance(); void setLanguage(const QString &); + void switchLayout(Qt::LayoutDirection); static void printHelp(); static void printVersion(); static void printLicense();