tags:

views:

304

answers:

1

I have a QTableWidget with 5 columns in it, how do I set all items on column 2 to be a QProgressBar?

I tried something like:

self.downloads_table = QtGui.QTableWidget(0, 5)
self.downloads_table.setItemDelegateForColumn(2, DownloadDelegate(self))

Where DownloadDelegate is:

class DownloadDelegate(QItemDelegate):

  def __init__(self, parent=None):
    super(DownloadDelegate, self).__init__(parent)

  def createEditor(self, parent, option, index):
    return QProgressBar(parent)

But the progress bar doesn't show up at all. Any idea?

A: 

The model must return itemEditable in flags()

Nightwish