[Qt-interest] text is exceeding the listview bounds in Qt

Andre Somers andre at familiesomers.nl
Mon Mar 15 15:50:54 CET 2010


ramesh.bs at robosoftin.com wrote:
> Hi.. Abhi thanks for the reply.
>
> i know how to set the delegate and all.. in the paint event i need to draw
> the string over a gradient rectangle.. but the problem is if the string is
> big i don't no what to do.. either i need to trim or any other else option
> there?.. i don't no tat trimming logic too so.. i am asking any body know
> how to tackle this problem.
>
>   
You could clip the painting area when drawing the text, or, if you draw 
only one line of text and it is appropriate for your application, you 
could use eliding from QFontMetrics::elidedText. Unfortunately, that 
method does not support rich text. A third option is to make sure that 
your cell is big enough to fit the whole text.

André




More information about the Qt-interest-old mailing list