title: Using setBackground correctly
body: <p>Hopefully an easy one for you...</p>
  
  <p>I've been trying to set the background color of a QtListWidgetItem, but I'm not having much luck - this is probably because I'm not using the QListWidgetItem correctly... In my test code I can set the foreground of every third item in the list, but setting the background seems to have no effect. Can anyone spot my stupid error? </p>
  
  <p>I've tested this out with both PyQt4 and PySide on Qt 4.7</p>
  
  <p>Thanks, Dan</p>
  
  <pre><code>import sys
  from PySide import QtCore, QtGui
  
  class List(QtGui.QListWidget):
      def __init__(self):
          super(List, self).__init__()
          self.populate()
  
      def populate(self):
          for i in range(32):
              item = QtGui.QListWidgetItem(self)
              item.setText('%d'%i)
  
              if i % 3 == 0:
                  brush = QtGui.QBrush()
                  brush.setColor(QtGui.QColor('red'))
                  item.setBackground(brush)
  
              if i % 3 == 1:
                  brush = QtGui.QBrush()
                  brush.setColor(QtGui.QColor('blue'))
                  item.setForeground(brush)
  
  if __name__ == '__main__':
  
      app = QtGui.QApplication(sys.argv)
  
      listw = List()
      listw.show()
  
      sys.exit(app.exec_())
  </code></pre>