I have a QTabWidget working correctly except that it doesn\'t re-size how I would expect it.
There are 2 tabs in the widget. Each has a QVBoxLayout with widgets in
This should do the trick; change the size policy depending on which tab is active.
def __init__(self):
super(Widget, self).__init__()
self.setupUi(self)
self.tabWidget_2.currentChanged.connect(self.updateSizes)
def updateSizes(self):
for i in range(self.tabWidget_2.count()):
self.tabWidget_2.widget(i).setSizePolicy(QSizePolicy.Ignored, QSizePolicy.Ignored)
current = self.tabWidget_2.currentWidget()
current.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum)