title: Automatically resizing label text in Qt - strange behaviour
body: <p>In Qt I have a composite widget that consists of several QLabels arranged inside QBoxLayouts. When the widget is resized I want the label text to scale to fill the label area and I have implemented resizing of the text in the resizeEvent.</p>
  
  <p>This works but there seems to be some sort of feedback loop happening. The composite widget is placed in a main window inside a QBoxLayout along with some other widgets. When the main window is made smaller, the composite widget initially maintains its size and then resizes toward the correct size in several steps  (about 10-15). If the the text height is set to more than about 0.8 times the label height then on resizing the text and containing widget grow larger with each step until eventually the app crashes.</p>
  
  <p>Is this the correct approach to achieve this effect? If so, what might the problem be with the resizing?</p>
  
  <p>Below is the resizeEvent code.</p>
  
  <pre><code>def resizeEvent(self, evt):
          print("resizeEvent", evt.size().width(), evt.size().height())
          QFrame.resizeEvent(self, evt)
  
          dataLabels = self.dataPanels.values()
  
          for label in dataLabels:            
              font = label.font()
              h = label.height()
              h2 = h * 0.8
              font.setPixelSize(h2)
              label.setFont(font)
  </code></pre>
  
  <p>(using PyQt4 4.8, Qt 4.7.4, Win 7 &amp; OSX 10.6)</p>