title: pyqt QTreeWidget setColumnWidth not working
body: <p>So I saw some similar questions posted about this, but maybe I'm just not smart enough to apply it to my situation.  In the following example, the only column that seems to be affected by the setColumnWidth is column 0.</p>
  
  <pre><code>''' A custom widget to set up the tree column widths '''
  
  from PyQt4 import QtGui
  
  class PCLTreeWidget(QtGui.QTreeWidget):
      def __init__(self,parent):
          QtGui.QTreeWidget.__init__(self,parent)
  
          ## set the sizes
          self.setColumnWidth(0,250)
          print self.columnWidth(0)
          self.setColumnWidth(1,250)
          print self.columnWidth(1)
          self.setColumnWidth(2,100)
          print self.columnWidth(2)
          self.setColumnWidth(3,1)
          print self.columnWidth(3)
          self.setColumnWidth(4,1)
          print self.columnWidth(4)
          self.setColumnWidth(5,3)
          print self.columnWidth(5)
          self.setColumnWidth(6,1)
          print self.columnWidth(6)
          self.setColumnWidth(7,1)
          print self.columnWidth(7)
          self.setColumnWidth(8,1)
          print self.columnWidth(8)
          self.setColumnWidth(9,1)
          print self.columnWidth(9)
  </code></pre>
  
  <p>Output:
  250
  0
  0
  0
  0
  0
  0
  0
  0
  0</p>
  
  <p>What am I missing?</p>
  
  <p>update:  looks like I need to do it in the resizeEvent function since the columns are setup yet in the <strong>init</strong> function:</p>
  
  <pre><code>''' A custom widget to set up the tree column widths '''
    2
    3 from PyQt4 import QtGui
    4
    5 class PCLTreeWidget(QtGui.QTreeWidget):
    6     def __init__(self,parent):
    7         QtGui.QTreeWidget.__init__(self,parent)
    8
    9
   10     def resizeEvent(self, resizeEvent):
   11         ## handle resize
   12         self.setColumnWidth(0,250)
   13         self.setColumnWidth(1,250)
   14         self.setColumnWidth(2,30)
   15         self.setColumnWidth(3,60)
   16         self.setColumnWidth(4,50)
   17         self.setColumnWidth(5,250)
   18         self.setColumnWidth(6,35)
   19         self.setColumnWidth(7,45)
   20         self.setColumnWidth(8,60)
   21         self.setColumnWidth(9,35)
   22         self.header().setResizeMode(0,QtGui.QHeaderView.Stretch | QtGui.QHeaderView.Interactive)
   23         self.header().setResizeMode(1,QtGui.QHeaderView.Stretch)
   24         self.header().setResizeMode(2,QtGui.QHeaderView.Fixed)
   25         self.header().setResizeMode(3,QtGui.QHeaderView.Fixed)
   26         self.header().setResizeMode(4,QtGui.QHeaderView.Fixed)
   27         self.header().setResizeMode(5,QtGui.QHeaderView.Stretch)
   28         self.header().setResizeMode(6,QtGui.QHeaderView.Fixed)
   29         self.header().setResizeMode(7,QtGui.QHeaderView.Fixed)
   30         self.header().setResizeMode(8,QtGui.QHeaderView.Fixed)
   31         self.header().setResizeMode(9,QtGui.QHeaderView.Fixed)
  </code></pre>