title: QHeaderView: Stretch or ResizeToContents based on columns' content size
body: <p>I have a QTableWidget with a last column that contains text of variable length.</p>
  
  <p>I want to either stretch or resize the last section of the QHeaderView to its contents based on the size of the section. If the content size does not exceed the remaining space in the widget, I want to stretch it (to prevent an ugly, unfilled space in the widget). I can achieve this by using <code>setStretchLastSection(True)</code>. However, if the content size exceeds the stretched column, the last parts of my contents are cut, as the column is not resized. QHeaderView provides the <code>ResizeToContents</code> ResizeMode for this case, but this leaves the widget with unfilled space in the case of short contents.</p>
  
  <p>I thought about manually resizing the column size. Unfortunately, I cannot access the content size directly, as <code>sectionSizeFromContents()</code> is protected. I guess I could subclass QHeaderView and reimplement it, but I was wondering if there is a better solution.</p>