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?



  • I would set the direction for the whole application in one go: QApplication::setLayoutDirection. That should take care of the issue.



  • 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



  • You can download new version of Qt. It should contain Persian translation. If you have a limited internet access, I can send you .qm file



  • Reading this post might help you:
    "ترجمهٔ فارسی کیوت":http://developer.qt.nokia.com/forums/viewthread/9441



  • could you please specify the package name and also version number explicitly



  • Persian translation is added is added at July 19th, 2011. So it should be published with Qt 4.7.4 I think... Also if you have Qt source code from gitorious, you can easily merge the code to your repository with git.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.