View Single Post
Old 12-15-2011, 09:43 AM   #10
kiwidude
Calibre Plugins Developer
kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.
 
Posts: 4,637
Karma: 2162064
Join Date: Oct 2010
Location: Australia
Device: Kindle Oasis
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?
kiwidude is offline   Reply With Quote