当前位置:网站首页>Qt|QLable多行展示时更改行间距
Qt|QLable多行展示时更改行间距
2022-07-25 08:31:00 【InfoQ】
前沿
开发环境:WIN10 + VS2017 + Qt5.14.2 64位

功能实现
1:文本自动换行
ui.labContent->setFiexedWidth(800);
ui.labContent->setText(qsContent);
ui.labContent->setWordWarp(true);
ui.labContent->adjustSize();
2:文本字体设置
//获取:QLabel默认的字体样式
QFont fontContent = ui.labContent->font();
//设置:字体样式:微软雅黑
fontContent->setFamily("Microsoft YaHei");
//设置:字体大小:22
fontContent->setPixelSize(22);
//设置:字体颜色值
QPalette peContent;
peContent.setColor(QPalette::WindowText, QColor(51, 51, 51));
ui.labContent->setPalette(peContent);
//字体绑定
ui.labContent->setFont(fontContent);
3:行间距设置
<p style='line-height:40px;'></p>
<p style='width:100%;'></p>
<p style='white-space: pre-wrap'></p>
QString qsShow = "<p style='line-height:40px; width:100% ; white-space: pre-wrap; '>" + qsContent + "</p>";
总结
边栏推荐
- Record the process of two multi terminal troubleshooting
- node+js搭建时间服务器
- Chapter 3 business function development (realize the real-time response of the select all button)
- BigDecimel转人民币大写
- NVIDIA programmable reasoning accelerator tensorrt learning notes (II) - practical operation
- 【黑马程序员】Redis学习笔记004:主从复制+哨兵模式+集群
- Svg creative underline style JS special effect
- Advanced C language (11) - user defined data types
- Node+js build time server
- OpenGL es to realize the visualization of real-time audio
猜你喜欢

Memcached data cache database (improve efficiency)

【黑马程序员】Redis学习笔记002:持久化:RDB 和 AOF

Source code of pet adoption management system implemented by ssm+jsp+mysql

@Autowired注解的实现原理

【黑马程序员】Redis学习笔记003:Redis事务

刷题《剑指Offer》day02

Redis最佳实践

Redis学习

Recursive call to print every bit of an integer
![[dark horse programmer] redis learning notes 005: enterprise level solutions](/img/76/959d18994ab9eb170cbdbdccbe94e7.png)
[dark horse programmer] redis learning notes 005: enterprise level solutions
随机推荐
Database query optimization
[dark horse programmer] redis learning notes 001: introduction to redis + five basic data types
enq: HW – contention等待引起的故障分析
"Unable to recognize" yarn "item as cmdlet, function, script file
NVIDIA可编程推理加速器TensorRT学习笔记(二)——实操
RTOS系列(13):汇编LDR指令、LDR伪指令、[Rn]寄存器间接引用 详细解析
阿里云服务的网络解决方案
Interview questions: common faults and occurrence scenarios of redis
C#入门系列(三十) -- 异常处理
@Autowired注解的实现原理
【黑马程序员】Redis学习笔记003:Redis事务
2022-07-19 Daily: too many icml2022 papers to read? "One sentence comments on 1234 paper highlights" helps you quickly lock
TCGA simple download tool V16 installation error
Codeforces Round #809 Editorial(A,B,C)
Blue and white porcelain used by Charles
Redis4.0.14 sentinel automatic failover failed
[shader realizes shadow projection effect _shader effect Chapter 8]
刷题《剑指Offer》day02
Memcached data cache database (improve efficiency)
CAS operation