title: PyQt Set column widths
body: <p>I've got a simple QTableView and I essentially want to emulate this:</p>
  
  <pre><code>view.horizontalHeader().setSectionResizeMode(QHeaderView.ResizeToContents)
  </code></pre>
  
  <p>However, I cannot actually use this, since this calls <code>sizeHint</code> on every single row, which is unacceptable in my case, since the widget needs to be responsive on startup and the calculations take a long time for all the rows. Therefore this is not an option.</p>
  
  <p>I know what the size of a single column, which is always the same, and is always the one with largest height. However, the width of this cell may not always be the widest of all the cells in a row. I've made those cells the correct size by doing this, but this obviously makes all the cells the same size, and many are now far too wide.</p>
  
  <pre><code>view.horizontalHeader().setDefaultSectionSize(200)
  view.verticalHeader().setDefaultSectionSize(100)
  </code></pre>
  
  <p>I've also tried to set individual column widths, but that seems to have no effect at all on the widths, like this:</p>
  
  <pre><code>view.setColumnWidth(0, 5)
  </code></pre>
  
  <p>Also, setting individual column widths isn't that great, since I can't know in advance how wide they're going to be.</p>
  
  <p>Is there any way to use (or emulate) the <code>ResizeToContents</code> approach (as shown above), but in a way that wouldn't require checking all the cell sizes?</p>