title: layout sizeHint qwidget
body: <p>I am creating a widget which contains a chess table and six buttons which are displayed in 2 rows beneath the chess table. The button rows are wider than the chess table. Chess table and buttons are in a QGridLayout. Chess table has its own sizeHint calculated from the size of the squares.</p>
  
  <p>After some operations I delete the buttons and resize the widget that contains everything to its sizeHint (<code>resize(sizeHint())</code>). The widget resizes properly in the vertical direction but in the horizontal direction it remains as wide as if the button rows were there. What is the problem ?</p>
  
  <p>If I construct the widget only with the chess table the layout sizes the widget properly.</p>
  
  <p>I am adding the code:</p>
  
  <p>In the constructor of the window:</p>
  
  <pre><code>renderArea = new RenderArea(m_row,m_col,m_grid);
  
  formLayout = new QGridLayout;
  
  formLayout-&gt;addWidget(renderArea,0,0,1,3);
  
  setLayout(formLayout);
  </code></pre>
  
  <p>In the function that adds the buttons:</p>
  
  <pre><code>addPlaneButton = new QPushButton(tr("Add plane"));
  cancelButton = new QPushButton(tr("Cancel operation"));
  movePlaneButton = new QPushButton(tr("Move plane"));
  deletePlaneButton = new QPushButton(tr("Delete plane"));
  rotatePlaneButton = new QPushButton(tr("Rotate plane"));
  doneButton = new QPushButton(tr("Done"));
  doneButton-&gt;setEnabled(false);
  
  infoLabel = new QLabel(tr("Welcome to the plane editor"));
  statusLabel = new QLabel();
  
  formLayout-&gt;addWidget(statusLabel,1,0,1,3);
  formLayout-&gt;addWidget(infoLabel,2,0,1,3);
  formLayout-&gt;addWidget(addPlaneButton,3,0);
  formLayout-&gt;addWidget(movePlaneButton,3,1);
  formLayout-&gt;addWidget(deletePlaneButton,3,2);
  formLayout-&gt;addWidget(rotatePlaneButton,4,0);
  formLayout-&gt;addWidget(cancelButton,4,1);
  formLayout-&gt;addWidget(doneButton, 4,2);
  </code></pre>
  
  <p>In the function that deletes everything besides the chess table:</p>
  
  <pre><code>formLayout-&gt;removeWidget(addPlaneButton);
  formLayout-&gt;removeWidget(cancelButton);
  formLayout-&gt;removeWidget(movePlaneButton);
  formLayout-&gt;removeWidget(deletePlaneButton);
  formLayout-&gt;removeWidget(rotatePlaneButton);
  formLayout-&gt;removeWidget(doneButton);
  formLayout-&gt;removeWidget(infoLabel);
  formLayout-&gt;removeWidget(statusLabel);
  
  
  delete addPlaneButton;
  delete cancelButton;
  delete movePlaneButton;
  delete deletePlaneButton;
  delete rotatePlaneButton;
  delete doneButton;
  
  
  delete infoLabel;
  delete statusLabel;
  
  resize(sizeHint());
  </code></pre>
  
  <p>The sizeHint for the chess table is calculated as:</p>
  
  <pre><code>return QSize(m_rowNo*spacing, m_colNo*spacing)+QSize(31,31);
  </code></pre>