Results 1 to 4 of 4

Thread: Set application's layout direction

  1. #1
    Join Date
    Jul 2012
    Posts
    14
    Thanked 1 Time in 1 Post
    Platforms
    Unix/X11 Windows

    Default Set application's layout direction

    Hi,

    i want to change layout direction of whole Qt application from left to right and from right to left depends upon language selected by user. if user choose English then layout will be left to right and if he/she chooses urdu/arabic then layout will be right to left. i have done some coding but i am facing problem of Qapplication::setlayoutdirection api. it is not working or something else. i am running qt application on ubuntu 12.04 desktop environment.
    below is my sample code of main function:

    QApplication a(argc, argv);
    if(LAYOUT_RTL == g_layout_type)
    {
    a.setLayoutDirection(Qt::RightToLeft);
    qDebug() << "Right to left mode:" << a.layoutDirection() << a.isRightToLeft();
    }
    else if(LAYOUT_LTR == g_layout_type)
    {
    a.setLayoutDirection(Qt::LeftToRight);
    qDebug() << "Left to right mode:" << a.layoutDirection() << a.isRightToLeft();
    }
    a.exec();
    thanks in advance

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Set application's layout direction

    it is not working or something else.
    What are we supposed to do with this? We have no idea what behaviour you consider "not working or something else." We cannot see the rest of your program or what you see it doing.

    Post a small, complete example that demonstrates the problem.

  3. #3
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 452 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: Set application's layout direction

    Hi,

    i want to change layout direction of whole Qt application from left to right and from right to left depends upon language selected by user. if user choose English then layout will be left to right and if he/she chooses urdu/arabic then layout will be right to left.
    User language and the layout (GUI layout) are different things. All that Qt can offer (as of Qt3/4/5) is language based text orientation (and translation). QWidgets do not address such requirements.
    Last edited by Santosh Reddy; 2nd March 2013 at 22:01.
    When you know how to do it then you may do it wrong.
    When you don't know how to do it then it is not that you may do it wrong but you may not do it right.

  4. #4
    Join Date
    Jul 2012
    Posts
    14
    Thanked 1 Time in 1 Post
    Platforms
    Unix/X11 Windows

    Default Re: Set application's layout direction

    Hi, thanks for reply... i have solved issue .. there was some problem from my side in installing new language.

Similar Threads

  1. DockWidgetArea change and layout direction change
    By mstegehu in forum Qt Programming
    Replies: 1
    Last Post: 21st February 2012, 21:24
  2. Title Bar Direction Not as per Arabic Language Layout.
    By pavanbarot in forum Qt Programming
    Replies: 0
    Last Post: 27th September 2011, 19:09
  3. problem with layout direction and QFileDialog
    By hadi in forum Qt Programming
    Replies: 0
    Last Post: 10th May 2011, 16:44
  4. Replies: 1
    Last Post: 4th May 2011, 08:49
  5. layout direction issues with QGraphicsScene
    By sanjayshelke in forum Qt Programming
    Replies: 2
    Last Post: 16th June 2009, 23:23

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.