Changing layout

  • 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() 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);
    // 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": for more information and example code.

Log in to reply