PDA

View Full Version : QItemDelegate



Alex_123
10th October 2008, 18:15
Hi. I'm trying to calculate height of an item in QListView in QComboBox.
I need height of a single item (n) and height of the whole drop-down box. I tried to make a descendant from QItemDelegate and implement the paint function in order to try and get the rect property though it doesn't even called when I show the items.

So I made a descendant class object and called Combo->setItemDelegate(obj).

Thanks in advance.

jpn
12th October 2008, 11:40
I tried to make a descendant from QItemDelegate and implement the paint function in order to try and get the rect property though it doesn't even called when I show the items.
The function signature must match, including constness. Perhaps you forgot the last "const":


void paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const;