Resizing StackWidget When Page Changes



  • I have a stack widget with two buttons (same size) and another page has one button which is also the same size. If I switch the page how can I get the widget (dialog) that the stack widget is in to resize so that there is no space. I thought I could just change the policy of the stack widget and it's layouts to minimum but this didn't do anything. A lot of people said I needed fixed. Frankly non of them do anything. Is there some sort of update function I need to call? I tried update and resizing the widget and it's layout to their minimum size. I've tried a ton of other stuff but nothing works.


  • Lifetime Qt Champion

    Hi,

    From the top of my head you can try to ask for the size hint of the contained widget and then resize the stack widget based on that.

    Hope it helps



  • Contained widget? Would that be the stack widget or the dialog that the stack widget is in? I have more elements outside the stack widget. For example:

    • Button
    • Stack Widget (2 pages)
      • Button
        OR
      • Button
      • Button
    • Button
      So when you switch the page the widget everything is contained in stays the same size. The dialog should shrink in size.

  • Lifetime Qt Champion

    I was thinking about the widget that are the pages of your stack.


Log in to reply
 

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