G'day,
After a discussion in another thread I am experimenting with a custom delegate (QStyledItemDelegate) to handle "date" fields coming from an Sqlite database. I've built the delegate and, for the most part, got it working. I have called QTableView::resizeColumnsToContents() and set QHeaderView::setResizeMode(QHeaderView::ResizeToContents) so the display mode has the date column resized to fit.
The problem comes when I go into edit mode. The text string ISO data coming from Sqlite is converted to QDate and passed to the QDateEdit control the delegate has set up to edit it. The editor is rendered in the QTableView cell but the spin box controls invariably overlay the right end of the date.
I am struggling to find how I can have the column resize to fit the QDateEdit spin box controls and still have the date displayed without truncation. I'm guessing that some magic is required in the delegate's size hint but cannot see how I can determine a good hint. There must be some way to get at the size of the edit control (no pointer to this is passed to sizeHint()) to add to the string size but I'm not familiar enough with the style options stuff to locate it.
Any nudges in the right direction would be greatly appreciated.
Chris W
QT4.5.1
Bookmarks