title: how to update ( setvalue , sorting , editing , background color ) QProgressBar (QitemDelegate) inside QTableview (QAbstractTableModel)
body: <p>I am a NEWBIE dev on python , this is my first python script .
  I added a QProgressBar to QTableview (QAbstractTableModel) as a QItemDelegate and it works.
  QProgressBar did show up , but it cant update automatically when i edit or sort the QTableview.
  QItemDelegate 's Background color , alignment , edit are not follow the role?
  any idea ? Do i need to use setmodeldata or seteditordata ? any example in this case?</p>
  
  <p>here's the class of QAbstractTableModel</p>
  
  <pre><code>def data(self, index, role):
      col = index.column ()
      row = index.row()
      if not index.isValid():
          return QVariant()
      elif role == Qt.BackgroundColorRole and row%2 == 0 :
          return QVariant(QColor(60,60,60))            
      elif role == Qt.DisplayRole and col != 3 :
          return QVariant(self.arraydata[row][col])
      elif role == Qt.EditRole and col != 3 :
          return QVariant(self.arraydata[row][col])
      elif role == Qt.ToolTipRole :
          return QVariant("tool tips")
      elif role == Qt.TextAlignmentRole:
          return QVariant(Qt.AlignCenter | Qt.AlignCenter)
  </code></pre>
  
  <p>here's the delegate code :</p>
  
  <pre><code>class progressDelegate(QItemDelegate):
      def __init__(self, parent  ):
  
          QItemDelegate.__init__(self, parent )
          self.tb = self.parent().shotslistTable 
          self.tm = self.parent().tm
  
      def paint(self, painter, option, index):
  
          self.pbar = QProgressBar(self.parent())
          col = index.column ()
          row = index.row ()
          self.pbar.setMinimum(0)
          self.pbar.setMaximum(100)
          self.pbar.setValue (int(self.tm.arraydata[row][col]))
          self.pbar.setMaximumHeight(24)
          if not self.tb.indexWidget(index):
              self.tb.setIndexWidget(
                  index, 
                  self.pbar
              )
  </code></pre>