[SOLVED] resizing a QMdiSubWindow



  • So I have a widget with a minimal layout that allows me to resize its contents when I stretch the window. When I try to put this widget inside a QMdiSubWindow, the contents no longer resize (only the frame). If I apply a layout to the subwindow, I get a warning that it already has one. Although I know there's a way to delete the existing layout, I'd prefer not to since that presumably means I'd have to reimplement the minimize/restore buttons, etc. Is there a simpler way to achieve what I want?

    [EDIT: Thanks, Chris. Your assurance that the resizing ought to work "as is" prompted me to review my program more closely. It turns out that one of the subwidgets in the subwindow has to be destroyed and reconstructed, but my layout code wasn't taking that into account.]



  • The behaviour you want is the default when you QMdiArea::addSubWindow() your widget directly or set your widget as the contained widget of a QMdiSubWindow before adding it. You'll need to post a minimal, compilable example that demonstrates your problem so we can see where you are coming unstuck.



  • If you are removing/destroying and replacing widgets in a layout to switch between a couple of options you should consider QStackedWidget.


Log in to reply
 

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