Ok i've rewritten my delegate to use standard painter->drawText() instead of QTextDocument. It's good to know i can use both though.

Take a look at QStyleOptionViewItem::rect that is passed to the sizeHint() method. It contains the rectangle of the view occupied by the item.
That was my first thought too but when I qDebug inside the sizeHint() method i get "QRect(0,0 0x0)". I've tried various settings on QListWidget but it never changes. That same parameter works fine in the paint() method.
Hmm, i just noticed i was using Qt 4.2.2 so i'm going to upgrade to Qt 4.3.1 and see if anything changes.

I'm still not entirely sure how to use QModelIndex::internalPointer(). But once I get my paint() and sizeHint() methods working I'll switch to QListView and a custom model and worry about it then.


I've got to say that QT Centre kicks butt and major kudos to you wysota! You've helped me out so incredibly much! thanks!