Right To left alignment in Qaction
-
hi i want to translate my software to Persian (Farsi)
*note:farsi is a right to left language!
in menu i use "setLayoutDirection" to make menu right to left but in child of menu text is left To right alignment.so i want to change to right To left. how can i do this?
-
it's not worked!
i change my main to this
@#include "ekgsplash.h"int main(int argc, char *argv[])
{
QApplication Foad(argc, argv);QTranslator myappTranslator; QString app_name = "foad_"; myappTranslator.load("foad_fa.qm"); Foad.installTranslator(&myappTranslator); QApplication::setLayoutDirection(Qt::RightToLeft); Foad.setLayoutDirection(Qt::RightToLeft); EKGsplash *splashScreen = new EKGsplash(); splashScreen->show(); EKGWindow *ekgwindow = new EKGWindow(); QObject::connect(splashScreen,SIGNAL(splashShowed()),ekgwindow,SLOT(show())); return Foad.exec();
}
@
if it's incorrect say
-
Using QApplication::setLayoutDirection(Qt::RightToLeft) solves most of the problem. The only point remaining is that the title bar of the window will still be left to right. This can be solved using this in your window constructor:
@HWND hWnd = this->winId();
long extendedStyle = GetWindowLong(hWnd, GWL_EXSTYLE);
SetWindowLong(hWnd, GWL_EXSTYLE, extendedStyle | WS_EX_RIGHT | WS_EX_NOINHERITLAYOUT);@ -
Not a real answer, but also notice to install Persian translator of Qt itself in order to have a completely translated UI :) This way you don't need to set direction for all of your forms anymore. It will set it automatically when you load translation. And also will set direction to LTR when uninstalling translator, for example when you change language of app to English.
Cheers
-
[quote author="Pooyan" date="1315244906"]Using QApplication::setLayoutDirection(Qt::RightToLeft) solves most of the problem. The only point remaining is that the title bar of the window will still be left to right. This can be solved using this in your window constructor:
@HWND hWnd = this->winId();
long extendedStyle = GetWindowLong(hWnd, GWL_EXSTYLE);
SetWindowLong(hWnd, GWL_EXSTYLE, extendedStyle | WS_EX_RIGHT | WS_EX_NOINHERITLAYOUT);@
[/quote]
it's not work for qaction in menu!!!!! -
[quote author="soroush" date="1315294539"]Not a real answer, but also notice to install Persian translator of Qt itself in order to have a completely translated UI :) This way you don't need to set direction for all of your forms anymore. It will set it automatically when you load translation. And also will set direction to LTR when uninstalling translator, for example when you change language of app to English.
Cheers[/quote]
ok how can i install Persian translator of Qt!
also what do you mean are you mean use Qt linguist?
i use Qt4 linguist but it's not solved my problem -
Reading this post might help you:
"ترجمهٔ فارسی کیوت":http://developer.qt.nokia.com/forums/viewthread/9441