qt - QLabel : interlinea/linespacing in WordWrap mode

标签 qt qt4

在 WordWrap 模式下,如何在 QLabel 中设置行高?

最佳答案

使用 HTML 文本:

QString template = "<p style=\"line-height:%1%\">%2<p>";
QString targetText = template.arg(myPercentage).arg(myTex);
QLabel *l = new QLabel(targetText, this);

其中 myPercentage 就像 60 - 80。
您将在 WordWrap 模式下获得浓缩行

关于qt - QLabel : interlinea/linespacing in WordWrap mode,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2749612/

相关文章:

string - 用斜线分割字符串

c++ - 调用定义函数时在QT Creator中获取 "undefined reference"

user-interface - 如何在另一个小部件内使用QColorDialog而不将其用作单独的对话框?

c++ - cv::Mat 到 QImage 的转换无法正常工作

python - PyQt - 加载多个 UI 文件

c++ - 从 TCP 套接字读取

qt - 平面 QPushButton,背景颜色不起作用

c++ - qtquickcontrolsapplication.h 上的 Qt 创建者错误

c++ - 选中多个项目时如何清除QListView的选择?

python - 为什么 PyQt connect() 语法如此冗长?