Re: Squeeze text in QLabel
Apart from playing with font styles and stretch factors( see QFont::setStretch) you could do it like you proposed: subclass QLabel and paint the text manually, using scale, etc.
Regards
Re: Squeeze text in QLabel
if you want to scale it or reset the pointsize of the font, you could calc with the length of the string (the string you want to draw onto the label) and the current pointsize of the font, wether its longer than the widgets width. if this is so, you reduce the pointsize of the font, by the factor you can calc with widget.width/(font.pointSize*string.length).
hope you understand, bad english
Re: Squeeze text in QLabel
Thank marcel, but the problem is that text in database contains, some time, html tags and if i want render it using this method i have to use QTextDocument and, if possible, I would avoid it. Instead if was possible stretching the content of a qlabel it was perfect.
Cheers
Re: Squeeze text in QLabel
hä?
when i understand you in the right way, you want to stretch the contents completely and not only some stringsa?
than draw on a pixmap and set the pixmap to the label!
Re: Squeeze text in QLabel
ok kernel_panic, I give it a try.
Regards