title: How to customize QTreeWidget header's font
body: <p>Using:</p>
  
  <pre><code>tree=QtGui.QTreeWidget()
  tree.setHeaderLabels(['Column 1','Column 2','Column 3'])
  tree.setColumnWidth(0, 48)  
  tree.setColumnWidth(1, 48)  
  tree.setColumnWidth(2, 48)  
  </code></pre>
  
  <p><code>QTreeWidget</code> is created. Its column headers are given names. And headers horizontal sizes are set.</p>
  
  <p>Now I would like to customize the headers font size.</p>
  
  <pre><code>font = QtGui.QFont()
  font.setPointSize(8)
  tree.headerItem().setFont(0, font)
  </code></pre>
  
  <p>But <code>.setFont</code> used in syntax like this does not have any visible effect on font size used in headers.</p>
  
  <p>I've also tried:</p>
  
  <pre><code>tree.headerItem().setFont(0, font)
  tree.headerItem().setFont(1, font)
  tree.headerItem().setFont(2, font)
  </code></pre>
  
  <p>with no success. What method to use to customize font size used in QTreeWidget's column headers?</p>
  
  <h1>EDITED LATER:</h1>
  
  <p>Example 1 makes the column headers larger with no effect on font size (?!):</p>
  
  <pre><code>from PyQt4 import QtCore, QtGui
  app = QtGui.QApplication([])
  tree=QtGui.QTreeWidget()
  tree.setHeaderLabels(['One','Two','Tree','Four','Five'])
  font=QtGui.QFont()            
  font.setPointSize(24)
  tree.header().setFont(font)
  tree.show()
  sys.exit(app.exec_())
  </code></pre>
  
  <p>Example 2 tries to use QSS = no effect on font size again:</p>
  
  <pre><code>from PyQt4 import QtCore, QtGui
  app = QtGui.QApplication([])
  tree=QtGui.QTreeWidget()
  tree.setHeaderLabels(['One','Two','Tree','Four','Five'])
  tree.header().setStyleSheet('font: bold 24px; font-size: 32pt; font-family: Courier;')
  tree.setStyleSheet('font: bold 24px; font-size: 32pt; font-family: Courier;')
  tree.show()
  sys.exit(app.exec_())
  </code></pre>
  
  <p>Example 3 uses setHeaderItem. No success:</p>
  
  <pre><code>from PyQt4 import QtCore, QtGui
  app = QtGui.QApplication([])
  tree=QtGui.QTreeWidget()
  
  font=QtGui.QFont() 
  font.setPointSize(36)
  item=QtGui.QTreeWidgetItem()
  item.setText(0,'Column name')
  item.setFont(0,font)
  tree.setHeaderItem(item)    
  tree.show()
  sys.exit(app.exec_())
  </code></pre>
  
  <h1>EXAMPLE 5 via MAIN WINDOW:</h1>
  
  <pre><code>from PyQt4 import QtCore, QtGui
  app = QtGui.QApplication([])
  mainWindow=QtGui.QMainWindow()
  mainWidget=QtGui.QWidget()
  mainWindow.setCentralWidget(mainWidget)
  mainLayout = QtGui.QVBoxLayout()
  mainWidget.setLayout(mainLayout)
  mainWindow.setStyleSheet('QWidget { font: bold italic large "Times New Roman" }')
  tree=QtGui.QTreeWidget()
  tree.setHeaderLabels(['One','Two','Tree','Four','Five'])
  mainLayout.addWidget(tree)
  mainWindow.show()
  sys.exit(app.exec_())
  </code></pre>
  
  <h1>EDIT # 2</h1>
  
  <p>I've just run these example codes on another machine (OSX). And to my surprise the code is working and the header font is set properly. Interesting what could be a reason it is working on one Mac and doesn't work on another? Could it be a <code>sip</code> issue? Qt Version? PyQt version? Here is the screenshot:
  <img src="https://i.stack.imgur.com/2WECP.png" alt="enter image description here">
  <img src="https://i.stack.imgur.com/bkhnb.png" alt="enter image description here"></p>