title: PyQt Tableview row background colour based on cell value
body: <p>I am using Python3+ and Qt5 (although happy to have Py2.7 and Qt4 answers!).
  Totally confused by the vast documentation about styles, delegates, models and everything else.</p>
  
  <p>I've found it simple to set the background of alternate rows but I want to set the background for rows where one column matches a specific value (i.e. <code>Archive == True</code>). </p>
  
  <p>Alternate rows:</p>
  
  <pre><code>self.plainModel = QSqlQueryModel()
  self.create_model()
  self.linksTable.setModel(self.plainModel)
  self.linksTable.setAlternatingRowColors(True)
  self.linksTable.setStyleSheet("alternate-background-color: Lightgrey;background-color: white;")
  self.linksTable.resizeColumnsToContents()
  </code></pre>
  
  <p>I've seen an example showing how to do it <a href="https://stackoverflow.com/questions/15622053/pyqt-change-rowcell-collor-in-tableview">through the model</a> but this specific example seems to be simply replicating the alternate rows outcome, and after a few days staring a code I can't work out how to translate that to checking the archive column.</p>
  
  <p>Extract from <a href="https://stackoverflow.com/questions/15622053/pyqt-change-rowcell-collor-in-tableview">example</a>:</p>
  
  <pre><code>elif role == Qt.BackgroundRole:
      if index.row() % 2 == 0:
          return QBrush(Qt.yellow)
  elif role != Qt.DisplayRole:
      return QVariant()
  </code></pre>
  
  <p>I've found another <a href="https://stackoverflow.com/questions/10219739/set-color-to-a-qtableview-row">example using delegates</a> but can't at the moment get my head around it.</p>
  
  <p>Especially I still can't understand how you would choose which rows get the change, and can't understand how to apply a simply background colour as "option"! (Reading the documentation on QStyleOptionViewItem is sending me down the rabbit-hole!).</p>
  
  <p>Can you help?</p>