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?
10 replies
it’s not worked!
i change my main to this
- #include "ekgsplash.h"
- int main(int argc, char *argv[])
- {
- QTranslator myappTranslator;
- myappTranslator.load("foad_fa.qm");
- Foad.installTranslator(&myappTranslator);
- EKGsplash *splashScreen = new EKGsplash();
- splashScreen->show();
- EKGWindow *ekgwindow = new EKGWindow();
- 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
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:it’s not work for qaction in menu!!!!!
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.ok how can i install Persian translator of Qt!Cheers
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:
ترجمهٔ فارسی کیوت [developer.qt.nokia.com]
You must log in to post a reply. Not a member yet? Register here!



