Reputation: 3442
I'm quite new to Python, and I'm developing an app with the PySide library.
I have a QTabWidget
in which I will later define buttons/labels/... with some layouts. The question is simple : I'd like to have my active tab filling the window horizontally and vertically, even when I resize the window. For now its size is determined by the widgets I put in. Even with addStretch(1)
in a QHBoxLayout
or QVBoxLayout
I can't get it to expand.
Is there an easy way to do this (I'm not a Python expert yet) ?
Any help will be highly appreciated.
Upvotes: 0
Views: 2191
Reputation: 772
If your main window is QMainWindow then it is enough to insert QTabWidget with mainwindow->setCentralWidget()
- by default it will use all available space.
In other case, to have QTabWidget to follow the resizing/geometry change of parent widget, it is enough to make some layout on the parent widget and just insert QTabWidget there.
Code is approx (in Qt):
QWidget * dialog = ...
QTabWidget * tabs = new QTabWidget;
QVBoxLayout * vbox = new QVBoxLayout;
vbox->addWidget(tabs);
dialog->setLayout(vbox);
dialog->show();
Upvotes: 2