Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Maintain aspect ratio of application



  • I am trying to create a web application with multiple pages and widget. I would like to know how to use Qt designer to get the following effect. If the page is 800 by 480, I want widget 1 to be 200,120 (ie 0.25 * screenwidth, 0.25*screenheight) at 600 120,(ie 0.75 * screenwidth, 0.25 *screenheight) , widget 2 to be 400, 48(ie 0.5 * screenwidth, 0.1 *screenheight) at 200, 240,(0.25 *screenwidth, 0.5 *screenheight) . Thus if the page was resized to 1600, 960, the page and widget would be moved and resized such that widget1 would be 400,240 at position 1200, 240 and widget 2 would be 800, 96 at position 400, 480.
    Moreover I don't want to create a fixed window size as in once the application, I want to widgets to move and be resize as the window is resized.
    Is this best achieved using layouts, if so how does one achieve this?
    Thanks,
    Arjun



  • @arjun98 I think this can be achieved In the layout by setting the strech factor


Log in to reply