I’m trying to make an application consisting of a QMainWindow
, the central widget of which is a QToolBar
(it may not be usual, but for my purpose the toolbar’s well suited). Docks are allowed below only. I added a QDockWidget
to it, and a QAction
on the QToolBar
toggles the QDockWidget
on and off with removeDockWidget()
and restoreDockWidget()
.
The default size of the QMainWindow
is 800 by 24, QToolBar
’s maximumHeight
is set to 24 too. Right after the removeDockWidget()
is called, QMainWindow
’s geometry is set back to (0,0,800,24)
with setGeometry()
.
What I want to achieve is to resize the QMainWindow
’s height to 24 when the DockWidget
’s removed. The setGeometry()
seems to work since width and position change accordingly, but funnily enough, the height doesn’t budge. And that’s my problem really :)
What’s the matter you think?
Here is a screen-cast illustrating the issue at hand.
NB: if i create the same scenario using a QWidget rather than QMainWindow, and using a show()
or hide()
on the child widget, then I can resize the parent with adjustSize()
without problem: it seems the problem here above is QMainWindow specific.