I am writing very simple vector tool for graphics. I have rich text edited in QTextEditor
. I also have class extending QGraphicsScene
where all my drawings are. I want to somehow paint text from QTextEditor
on this scene? What are my options?
Best Regards!
You can use QPainter::drawtext()
method. basically you get a painter of the area you want to draw in and then use this method to draw your text.
QPainter p(this);
p.drawText(rect(), Qt::AlignCenter, "Hello World!");
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.