Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Right To left alignment in Qaction

    General and Desktop
    4
    11
    4456
    Loading More Posts
    • 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
      bijanbina last edited by

      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 Reply Quote 0
      • A
        andre last edited by

        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 Reply Quote 0
        • B
          bijanbina last edited by

          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 Reply Quote 0
          • P
            Pooyan last edited by

            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 Reply Quote 0
            • S
              soroush last edited by

              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 Reply Quote 0
              • B
                bijanbina last edited by

                [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 Reply Quote 0
                • B
                  bijanbina last edited by

                  [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 Reply Quote 0
                  • S
                    soroush last edited by

                    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 Reply Quote 0
                    • S
                      soroush last edited by

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

                      1 Reply Last reply Reply Quote 0
                      • B
                        bijanbina last edited by

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

                        1 Reply Last reply Reply Quote 0
                        • S
                          soroush last edited by

                          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 Reply Quote 0
                          • First post
                            Last post