[SOLVED]drawText() on multiple line
-
wrote on 14 Mar 2012, 09:05 last edited by
Hi all,
i have the necessity to draw text on a multiple line for create something like a QTextEdit in the Designer but with alone drawtext() i can't do this. other this i have a text to long and is more difficult calculate the string lenght for make a "for cycle" and draw line to line...
Anyone can halp me?
regard
-
wrote on 14 Mar 2012, 11:51 last edited by
Try:
@
painter->drawText(this->rect(), Qt::AlignCenter, "Qt by\nNokia");
@I'v tested, and worked.
This was done inside a QGraphicsView
-
wrote on 14 Mar 2012, 12:00 last edited by
but i not have ever the same text, i pick from DB and it isn't the way to operate because i can't control and modify the text....
-
wrote on 14 Mar 2012, 12:09 last edited by
Use "this overloaded drawText":http://qt-project.org/doc/qt-4.8/qpainter.html#drawText-10 with Qt::TextWordWrap flag
-
wrote on 14 Mar 2012, 14:06 last edited by
[quote author="cincirin" date="1331726961"]Use "this overloaded drawText":http://qt-project.org/doc/qt-4.8/qpainter.html#drawText-10 with Qt::TextWordWrap flag[/quote]
Run!!! Tanx so much!!!
-
wrote on 14 Mar 2012, 14:33 last edited by
[quote author="Vetryaspa" date="1331733990"]
[quote author="cincirin" date="1331726961"]Use "this overloaded drawText":http://qt-project.org/doc/qt-4.8/qpainter.html#drawText-10 with Qt::TextWordWrap flag[/quote]Run!!! Tanx so much!!![/quote]
You are welcome :-)
6/6