Note that there are some explanatory texts on larger screens.

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

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload