首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何使用QTextCursor设计水平线

如何使用QTextCursor设计水平线
EN

Stack Overflow用户
提问于 2018-04-24 16:16:42
回答 2查看 492关注 0票数 0

我试图在QTextCursor中添加一条水平线,并使用以下代码更改线条的厚度和颜色:

代码语言:javascript
复制
QTextDocument doc=new QTextDocument();
QTextCursor *cursor=new QTextCursor(doc);
cursor->insertHtml("<hr style='color:black;height:30px'>");

我能画水平线,但颜色和线的厚度没有变化。任何帮助都将不胜感激!

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2018-04-25 08:00:26

下面的代码可用于使用QTextDocument和QtextCursor绘制水平线:

代码语言:javascript
复制
QTextFrameFormat frameFormat;
frameFormat.setHeight(10);
frameFormat.setWidth(2350);
frameFormat.setBackground(Qt::black);
cursor->insertFrame(frameFormat);
票数 2
EN

Stack Overflow用户

发布于 2018-04-24 16:33:28

使用QTextDocument是不可能的。您可以阅读Qt 这里中支持的html子集。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/50006465

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档