Ahhh, think I might be getting somewhere. I have the rating delegate working anyway. This is what I did...
Code:
delegate = RatingDelegate(self)
self.setItemDelegateForColumn(self.rating_column_index, delegate)
...
# Inside a loop adding rows to the QTableWidget
item = QTableWidgetItem()
item.setData(Qt.DisplayRole, my_rating_value)
self.setItem(row, self.rating_column_index, item)
However when I try exactly the same trick for the CcDateDelegate, I get this error:
Code:
Traceback (most recent call last):
File "D:\CalibreDev\latest\calibre\src\calibre\gui2\library\delegates.py", line 267, in createEditor
AttributeError: 'QLineEdit' object has no attribute 'setDisplayFormat'
So maybe the default editor sitting behind QTableWidgetItem is a QLineEdit. Any guesses as to where I go with this? Do I need to do a setCellWidget instead of setItem, and use some other object instead?