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

Qt-interest Archive, January 2008
Custom QItemDelegate that varies height with width


Message 1 in thread

I am creating a custom QItemDelegate that displays rich text.  I have
the display working ok, however, I need the height to vary as the user
resizes the width of the view.  Unfortunately, the sizeHint for my
delegate only gets called when the item is first displayed, fixing the
height.  I assume, since text wrapping is an option on standard
delegates, that this functionality must be available.  Does anyone know
how to vary the delegate height as the width changes?

Thank you,
Rob

Message 2 in thread

On fredag den 11. Januar 2008, Bachrach, Robert L wrote:
> I am creating a custom QItemDelegate that displays rich text.  I have
> the display working ok, however, I need the height to vary as the user
> resizes the width of the view.  Unfortunately, the sizeHint for my
> delegate only gets called when the item is first displayed, fixing the
> height.  I assume, since text wrapping is an option on standard
> delegates, that this functionality must be available.  Does anyone know
> how to vary the delegate height as the width changes?

You have to make a connection from the horizontal header to the model. In the 
header, you can get a signal when the user resizes the columns, and you can 
then ask the model to change the size of the entry.

Bo.

-- 
 [ signature omitted ]