I'm using Qt 5.8. I have my custom QFrame (call it MyQFrame), which consists of several other QWidgets and can (and will) contain other instance of my custom MyQFrame. I set minimum size for MyQFrame. MyQFrame uses QGridLayout as layout.
This MyQFrame is placed inside of QScrollArea in QTabWidget. QScrollArea is set to be resizable (setWidgetResizable(true)
). In MyQFrame I tried to set size policy to expanding (setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
) but it was without effect.
This is (abstraction) how I create QTabWidget and QScrollArea:
QTabWidget* tabWidget = new QTabWidget();
QScrollArea* firstTab = new QScrollArea();
firstTab->setWidgetResizable(true);
tabWidget->addTab(firstTab, "first tab");
MyQFrame* myFrame1 = new MyQFrame();
firstTab->setWidget(myFrame1);
// ... adding other MyQFrames inside this one using methods in MyQFrame ...
I cannot get scroll area working. Instead of expanding parents of nested MyQFrames and adding scroll bar is last child getting overlaped by other MyQFrames. Looks like I'm missing something like setWidgetResizable
for MyQFrames, but this method is only in QScrollArea. I have no idea what should I try now. I'm still pretty new to this.
It should be more clear from image below.