[英]QT painting rich text on QGraphicsScene
I am writing very simple vector tool for graphics. 我正在为图形编写非常简单的矢量工具。 I have rich text edited in
QTextEditor
. 我已经在
QTextEditor
编辑了富文本格式。 I also have class extending QGraphicsScene
where all my drawings are. 我也有扩展
QGraphicsScene
类,我的所有图形都在其中。 I want to somehow paint text from QTextEditor
on this scene? 我想以某种方式在此场景上从
QTextEditor
绘制文本吗? What are my options? 我有什么选择?
Best Regards! 最好的祝福!
You can use QPainter::drawtext()
method. 您可以使用
QPainter::drawtext()
方法。 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!");
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.