[Interest] ItemDelegate::paint does not show anything
Eckhard Jokisch
qt at eckhard-jokisch.de
Sat Jun 16 13:48:30 CEST 2012
Hi all,
I wrote a custom itemdelegate for my treeview.
Editing works fine but I need to have a QTableWidget display the content
while the item is not edited.
My guess was to reimplement the paint function like this with just one
fiexed item for the test:
void RelationsDelegate::paint(QPainter *painter, const
QStyleOptionViewItem &option, const QModelIndex &index) const
{
QTableWidget widget(3,3);
widget.setRowCount(3);
widget.setColumnCount(3);
widget.setGeometry(option.rect);
QTableWidgetItem *item1 = new QTableWidgetItem("test1");
widget.setItem(0,0,item1);
painter->save();
widget.render(painter);
painter->restore();
}
All I get is a white field in the regarding field of the treeview. All
other items are shown as expected.
What do I miss?
Cheers
Eckhard
More information about the Interest
mailing list