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. Changing layout

Changing layout

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 1.6k Views 1 Watching
  • 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.
  • K Offline
    K Offline
    kitten
    wrote on last edited by
    #1

    hi to every one
    i wrote a program that has two language
    one of them should be right to left
    i want to change my layout when it is selected
    how can i do that?
    i use this code but it doesnt work
    @QApplication::setLayoutDirection(Qt::RightToLeft);@

    www.kitten.mihanblog.com

    1 Reply Last reply
    0
    • R Offline
      R Offline
      Ramblurr
      wrote on last edited by
      #2

      QApplication::setLayoutDirection() doesn't affect already instantiated widgets.

      You need to call setLayoutDirection in your main() function like this

      @int main(int argc, char** argv)
      {
      QApplication app(argc, argv);
      app.setLayoutDirection(Qt::RightToLeft);
      // show stuff
      return app.exec();
      }@

      However, if you want to change the layout direction after your QApplication has been execed you need to install a new QTranslator and retranslteUi() your UI.

      See "this email thread":http://lists.qt.nokia.com/pipermail/qt-interest/2011-May/033798.html for more information and example code.

      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