Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Right To left alignment in Qaction
QtWS25 Last Chance

Right To left alignment in Qaction

Scheduled Pinned Locked Moved General and Desktop
11 Posts 4 Posters 5.0k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    bijanbina
    wrote on last edited by
    #1

    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?

    1 Reply Last reply
    0
    • A Offline
      A Offline
      andre
      wrote on last edited by
      #2

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

      1 Reply Last reply
      0
      • B Offline
        B Offline
        bijanbina
        wrote on last edited by
        #3

        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

        1 Reply Last reply
        0
        • P Offline
          P Offline
          Pooyan
          wrote on last edited by
          #4

          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);@

          1 Reply Last reply
          0
          • S Offline
            S Offline
            soroush
            wrote on last edited by
            #5

            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

            1 Reply Last reply
            0
            • B Offline
              B Offline
              bijanbina
              wrote on last edited by
              #6

              [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!!!!!

              1 Reply Last reply
              0
              • B Offline
                B Offline
                bijanbina
                wrote on last edited by
                #7

                [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

                1 Reply Last reply
                0
                • S Offline
                  S Offline
                  soroush
                  wrote on last edited by
                  #8

                  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

                  1 Reply Last reply
                  0
                  • S Offline
                    S Offline
                    soroush
                    wrote on last edited by
                    #9

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

                    1 Reply Last reply
                    0
                    • B Offline
                      B Offline
                      bijanbina
                      wrote on last edited by
                      #10

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

                      1 Reply Last reply
                      0
                      • S Offline
                        S Offline
                        soroush
                        wrote on last edited by
                        #11

                        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.

                        1 Reply Last reply
                        0

                        • Login

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • Users
                        • Groups
                        • Search
                        • Get Qt Extensions
                        • Unsolved