Trolltech Home | Qt-jambi-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 1

Qt-jambi-interest Archive, April 2007
Multiple lines and custom renderers


Message 1 in thread

Hi,

Is it possible to reder custom graphics and multiple lines for each
element in a QListWidget, for instance by using HTML ?

-=Børge


Message 2 in thread

Børge Austvold wrote:
> Hi,
> 
> Is it possible to reder custom graphics and multiple lines for each
> element in a QListWidget, for instance by using HTML ?

Hi Børge,

To do some custom rendering in an abstract item view you typically 
reimplement a custom delegate:

http://doc.trolltech.com/qtjambi-1.0/com/trolltech/qt/gui/QAbstractItemDelegate.html
http://doc.trolltech.com/qtjambi-1.0/com/trolltech/qt/gui/QItemDelegate.html

I would suggest you reimplement the sizeHint() and the paint() functions 
and use a QTextDocument internally to do the calculation of the size and 
do the painting.

http://doc.trolltech.com/qtjambi-1.0/com/trolltech/qt/gui/QTextDocument.html


-
best regards,
Gunnar