PDA

View Full Version : The direction of the showing of windows.



Mad Max
12th January 2007, 07:44
I would like to know which language the application uses this moment (I mean to which directed: left-to-right or right-to-left). Is there a way to know it?

momesana
12th January 2007, 08:21
try:
QApplication::layoutDirection() to get the enumeration describing this. Check the Class Documentation for QApplication for more on this.

Mad Max
12th January 2007, 09:53
Unfortunately this is for Qt4 only, but I need a solution for Qt3. Thanks for the answer none the less.

Mad Max
12th January 2007, 11:45
I found a solution. Perhaps it is slightly awry, but none the less it's works :) .


QLocale locale( getenv("LANG") );
QTranslator * translator = new QTranslator( this );
translator->load( QString("qt_%1.qm").arg( locale.name().section('_', 0, 0) ), "." );
qApp->installTranslator( translator );
QApplication::setReverseLayout( QApplication::tr( "QT_LAYOUT_DIRECTION" ) == "RTL" );

momesana
12th January 2007, 12:13
Qt3 seems to offer this:
QApplication::reverseLayout()

http://doc.trolltech.com/3.3/qapplication.html#reverseLayout


cheers
momesana

jacek
12th January 2007, 12:14
How about QApplication::reverseLayout()?

Mad Max
12th January 2007, 13:15
This method indicates current state. Unfortunately Qt does not set this flag automatically and each application should install the flag itself. The condition for the installation can be found only in the file of localization, reading a tag "QT_LAYOUT_DIRECTION". If you will look at qapplication.cpp then you can to see, how Trolls done this trouble themselves. They solved it by the same way :D .