Resize window screen when all tabs of tabWidget closed
-
I have a Desktop application, in which the left half of the screen is taken up by a label, and the right half of the screen is taken up by a tab widget. The centralwidget has a grid layout.
I want the behaviour of the application to be such that, when all the tabs of the tab widget are closed, the application window resizes (becomes smaller) and displays just the left half (label on the left) of the application.
As of now, when I close all the tabs of the tab widget, I have coded for the tab widget to hide (
ui->tabWidget->hide()
).
However, when this happens, instead of the window resizing, the label on the left half of the screen expands horizontally, and takes up the space created due to the hiding of the tab widget.How can I resize the screen, instead of making the label take up the empty space?
-
@BigBen
My guess: the space occupied by theQTabWidget
prior tohide()
is now available to its parent, which it passes onto the label/grid layout/whatever.Can you maybe try a QWidget::adjustSize() on some parent widget (whatever is appropriate) which would allow it to recalculate? Is that it? I never know, I just play with layouts etc. till they work :) If you want to limit sizes I think you have to used fixed size.
instead of the window resizing, the label on the left half of the screen expands horizontally
I may have misunderstood what you want. I think you may have to reduce the size of you want the window to shrink, do you mean the whole outer window?