PDA

View Full Version : Set application's layout direction



vivek.panchal
2nd March 2013, 11:46
Hi,

i want to change layout direction of whole Qt application from left to right and from right to left depends upon language selected by user. if user choose English then layout will be left to right and if he/she chooses urdu/arabic then layout will be right to left. i have done some coding but i am facing problem of Qapplication::setlayoutdirection api. it is not working or something else. i am running qt application on ubuntu 12.04 desktop environment.
below is my sample code of main function:

QApplication a(argc, argv);
if(LAYOUT_RTL == g_layout_type)
{
a.setLayoutDirection(Qt::RightToLeft);
qDebug() << "Right to left mode:" << a.layoutDirection() << a.isRightToLeft();
}
else if(LAYOUT_LTR == g_layout_type)
{
a.setLayoutDirection(Qt::LeftToRight);
qDebug() << "Left to right mode:" << a.layoutDirection() << a.isRightToLeft();
}
a.exec();
thanks in advance

ChrisW67
2nd March 2013, 21:36
it is not working or something else.

What are we supposed to do with this? We have no idea what behaviour you consider "not working or something else." We cannot see the rest of your program or what you see it doing.

Post a small, complete example that demonstrates the problem.

Santosh Reddy
2nd March 2013, 21:57
Hi,

i want to change layout direction of whole Qt application from left to right and from right to left depends upon language selected by user. if user choose English then layout will be left to right and if he/she chooses urdu/arabic then layout will be right to left.
User language and the layout (GUI layout) are different things. All that Qt can offer (as of Qt3/4/5) is language based text orientation (and translation). QWidgets do not address such requirements.

vivek.panchal
4th March 2013, 13:58
Hi, thanks for reply... i have solved issue .. there was some problem from my side in installing new language.