Fix #1934 (Would like to assign a year (not a full date) to a title)

This commit is contained in:
Kovid Goyal 2009-02-25 12:12:56 -08:00
parent 18c39c6e20
commit 9c3062a4b5

View File

@ -90,11 +90,11 @@ class DateDelegate(QStyledItemDelegate):
def displayText(self, val, locale): def displayText(self, val, locale):
d = val.toDate() d = val.toDate()
return d.toString('dd MMM yyyy') return d.toString('dd MMM yyyy')
if d.isNull():
return ''
d = datetime(d.year(), d.month(), d.day())
return strftime(BooksView.TIME_FMT, d.timetuple())
def createEditor(self, parent, option, index):
qde = QStyledItemDelegate.createEditor(self, parent, option, index)
qde.setDisplayFormat('MM/dd/yyyy')
return qde
class BooksModel(QAbstractTableModel): class BooksModel(QAbstractTableModel):
coding = zip( coding = zip(