title: Qt - Expanding layout to maximum size in Dock Widget
body: <p>I'm working on little CAD like program for our indie game project. I already have nicely working form with a bunch of widgets and so on. But one thing is bothering me.</p>
  
  <p>I'm using <code>DockWidgets</code> and inside these i have <code>QTableWidget</code> and empty Horizontal layout as container waiting for my <code>OpenGLWindow</code> class that i later initialize and put it into.
  When i start the app all <code>DockWidgets</code> are set to size of <code>QTableWidget</code> ignoring that the <code>OpenGLWindow</code> was added to the layout when the form instance was created and I have to expand the dock by myself.</p>
  
  <p>So is there any way to tell the dock widget to expand as much as possible?</p>
  
  <p>My <code>OpenGLWindow</code> looks like:</p>
  
  <pre><code>class OpenGLWindow : public QWindow, protected QOpenGLFunctions
  </code></pre>
  
  <p>And that's how I'm inserting it to the layout on startup:</p>
  
  <pre><code>OpenGLWindow * glwindow = new OpenGLWindow(...);
  QWidget * container = QWidget::createWindowContainer(glwindow,ui-&gt;dockWidget,Qt::Window);
  ui-&gt;horizontalLayout-&gt;addWidget(container);
  </code></pre>
  
  <p>I've tried to expand it by many different weird ways and now I'm realy out of ideas.</p>
  
  <p>Thanks for help.</p>
  
  <p><strong>Update:</strong>
  Thats size policy of container:</p>
  
  <pre><code>container-&gt;setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
  </code></pre>
  
  <p><strong>Update:</strong>
  The main problem is to adjust the QDockWidget to its maximal possible width.</p>
  
  <p><strong>Update:</strong>
  I'm still having same problem, but now new one appeared when I added one more OpenGLWindow sharing context with the previous one. Both container widgets are now little oversized at startup so they overlay the DockWidgets title and when i resize any widget within the main window they just resize to normal size like expected.</p>