Layout Auto Change Top/Bottom to Left/Right



  • Couldn't find this discussed anywhere but I basically have a layout like this:

    @| ----
    | | |
    | |____|@

    So, a thin long box beside a square (fixed size!) box. Now, as the size of the window changes, I want the thin long box to automatically turn in to a wide, short box:

    @-----------


    | |
    |_____|@

    The reason being that my second box must have a fixed size. The automatic layout I currently have doesn't change as I am specifying either QHBoxLayout or QVBoxLayout.

    Is this possible using layouts or otherwise?
    Thanks.



  • Please refer to the Qt example: $QTDIR\Examples\4.7\layouts\dynamiclayouts



  • Hm. In this example they swap the elements of the grid when a button is pressed.
    Not exactly what I'm looking for.

    The part I am most concerned about is finding when width > height changes or doing this automatically. The example does this with a button instead.

    Edit: I have the frame paint event monitoring width/height and then emitting a signal to the main window to swap my layout. This is working but seems a bit hacky.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.