I'm trying to implement a custom paint function for a QStyledItemDelegate subclass (QT4.8.2).
I've reviewed the StarItemDelegate example, among others, and it appears to be pretty straightforward. The delegate is assigned to a column of the table that indicates the record state. Column items are editable, but not user editable. I've implemented the delegate subclass and have proven that it works, but can't seem to get it to draw a simple icon.
The code for the paint function is:
{
painter->save();
QIcon icon(":./opencs.png");
QSize iconsize = option.decorationSize;
painter->drawPixmap(0.0, 0.0, icon.pixmap(iconsize.width(), iconsize.height()));
painter->restore();
}
Right now, I'm just trying to ensure that the paint function works. The icon is already used in other areas of the application, so I know that it works. I don't have a great grasp of QT just yet, so I'm certain it's a fairly straightforward problem to solve, but nothing jumps out at me from the forum posts I've perused or the QT examples I've managed to dig up.
Any thoughts?