[Qt-interest] Text width greater than the QRect

Andre Somers andre at familiesomers.nl
Fri Apr 1 07:38:34 CEST 2011


Op 31-3-2011 3:05, Marcelo Estanislau Geyer schreef:
> Hi,
>
> I'm using the function QPainter::drawText to draw a text. The problem 
> is I have a QRect with defined width and need to put a text that can 
> have a width greater than the QRect, so the text is not drawn, leaving 
> blank.
>
> How can I fix this? I do not care if the text cut out (Elide Mode ?), 
> as it is for a report.
>
> Thanks,
>
> Marcelo E. Geyer
Use QFontMetrics to created an elided version of your string before drawing.

André

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110401/542c43b9/attachment.html 


More information about the Qt-interest-old mailing list