I'm working on some desktop software that requires one static window with a frame filled with dynamic content. The frame is on the main window, and the main window has a grid layout that lets the widgets I've added through the editor to automatically resize/expand with window resizes.
I have created a custom widget (and made some variations with a frame and dockable widget) to try and get the desired behaviour. When I add this widget to a new layout (I've tried both QVBoxLayout and QGridLayout) and tell the frame to use that layout, no widget gets displayed, however, if I create the frame variant of the widget and parent it with the frame in the constructor (aka new CustomWidget( this->ui->my_frame ); ), it displays, but is clearly not following the layout (does not expand). No other combination of my custom widget (as a QWidget, QFrame, or QDockableWidget) will display in my frame, and if in the off-chance it does, it does not expand with window resize events.
I have read in some places that overriding the main window's resize event function may resolve this but that is only in cases when I am not using a layout - I'd much prefer using a layout.
I can get the desired output if I use fixed content and the QTabWidget but the client I am building this application for would greatly prefer me not to use tabs. Their competitor's software uses tabs and we both agree that it looks clunky.
I'm going to end up code the widget interface, I think, but now I'm curious why importing these widgets into a layout doesn't work as expected.