title: C++ resize a docked Qt QDockWidget programmatically?
body: <p>I've just started working on a new C++/Qt project. It's going to be an MDI-based IDE with docked widgets for things like the file tree, object browser, compiler output, etc. One thing is bugging me so far though: I can't figure out how to programmatically make a <code>QDockWidget</code> smaller. For example, this snippet creates my bottom dock window, "Build Information":</p>
  
  <pre><code>m_compilerOutput = new QTextEdit;
  m_compilerOutput-&gt;setReadOnly(true);
  dock = new QDockWidget(tr("Build Information"), this);
  dock-&gt;setWidget(m_compilerOutput);
  addDockWidget(Qt::BottomDockWidgetArea, dock);
  </code></pre>
  
  <p>When launched, my program looks like this (bear in mind the early stage of development):</p>
  
  <p><img src="https://i.stack.imgur.com/k25Zf.png" alt="Actual"></p>
  
  <p>However, I want it to appear like this:</p>
  
  <p><img src="https://i.stack.imgur.com/xkWGl.png" alt="Expected"></p>
  
  <p>I can't seem to get this to happen. The Qt Reference on QDockWidget says this:</p>
  
  <blockquote>
    <p>Custom size hints, minimum and maximum sizes and size policies should be implemented in the child widget. QDockWidget will respect them, adjusting its own constraints to include the frame and title. Size constraints should not be set on the QDockWidget itself, because they change depending on whether it is docked</p>
  </blockquote>
  
  <p>Now, this suggests that one method of going about doing this would be to sub-class <code>QTextEdit</code> and override the <code>sizeHint()</code> method. However, I would prefer not to do this just for that purpose, nor have I tried it to find that to be a working solution.</p>
  
  <p>I have tried calling <code>dock-&gt;resize(m_compilerOutput-&gt;width(), m_compilerOutput-&gt;minimumHeight())</code>, calling <code>m_compilerOutput-&gt;setSizePolicy()</code> with each of its options... Nothing so far has affected the size. Like I said, I would prefer a simple solution in a few lines of code to having to create a sub-class just to change <code>sizeHint()</code>. All suggestions are appreciated.</p>