Re: [Interest] QT QFontMetrics boundingRect failed to textwordwrap, thanks!

2017-11-29 Thread Shawn Rutledge
> On 28 Nov 2017, at 02:06, sq wrote: > > painter.drawText(textBoundingRect,Qt::TextWordWrap,text); Try Qt::TextWrapAnywhere. Those numbers get concatenated into one long “word”. ___ Interest mailing list Interest@qt-project.org

Re: [Interest] QT QFontMetrics boundingRect failed to textwordwrap, thanks!

2017-11-29 Thread Tony Rietwyk
Hi, In your call metrics.boundingRect, you have specified height=0. Doesn't that make the QRect invalid?  The help for this function states "The drawing, and hence the bounding rectangle, is constrained to the rectangle rect." - so you need to pass a very large value for height, and it

[Interest] QT QFontMetrics boundingRect failed to textwordwrap, thanks!

2017-11-29 Thread sq
Hello, in QT4.8 I have the following code, want to calculate the size of the rectangle with the line break, the result of the rect did not wrap at all. How can I get the size of rect that a long QString needed text-wrapped automatically?Thanks very much! QPainter painter(this);