Ok, one step forward, two backwards it seems. I found that converting my python date into a QDateTime meant that QTableWidget creates the right sort of editor. However, the next error I get is this:
Traceback (most recent call last):
File "D:\CalibreDev\latest\calibre\src\calibre\gui2\lib rary\delegates.py", line 277, in setEditorData
AttributeError: 'QAbstractTableModel' object has no attribute 'db'
I thought I could fudge this by doing something like this when I populate the table:
self.model().db = self.db
But that ain't doing it for me either. Wondering if I should just write my own CCDateDelegate that takes a db in, so it doesn't have to try to get it from the model...
EDIT - that is definitely what I am going to do. Because I can now see the next problem will be how the editor tries to get its value, since the delegate does some mapping column lookups, none of which I want to have to replicate.
Still, the Calibre class gave me something I can copy/paste from - thanks guys