当前位置:网站首页>Qt 中文和英文分别使用不同的字体
Qt 中文和英文分别使用不同的字体
2022-06-25 22:00:00 【北极熊的奋斗史】
记录一下Qt使用样式表指定中文、英文分别使用不同的字体的方法。
先看效果:

其实很简单:
lablel->setStyleSheet(QString("QLabel{ font-family:'Roman, 华文行楷'; font-size: 16pt; color: red; }");
字体的名称设置多个就行,中间用逗号隔开。
注意:先设置英文字体,再设置中文字体,这样qt会先在第一个字体中找,没找到再去第二个字体中找。
再记录一下Qt给软件整体设置字体的方法:
在main函数中添加如下代码:
QFont ff("Times New Roman, SimSun, SimSun-ExtB");
app.setFont(ff);
最后记录一下Qt在高分辨率下,字体抗锯齿的方法,目测这个方法在qt5.15以上版本有效
新建 qt.conf 文件,文件内容为:
[Platforms]
WindowsArguments = fontengine=freetype
然后将qt.conf放入项目的qrc资源文件中,资源路径为:
:/qt/etc/qt.conf
重新编译生成可执行文件即可
边栏推荐
- Efr32bg22 ble module (low power Bluetooth communication module) at command test
- UE4\UE5 蓝图节点Delay与Retriggerable Delay的使用与区别
- CDN加速是什么
- UE4_UE5结合offline voice recognition插件做语音识别功能
- 牛客小白月赛52--E 分组求对数和(二分)
- Live800在线客服系统:跨越时空做生意,从每次互动开始
- Recently prepared to translate foreign high-quality articles
- ES6 learning -- let
- 问题记录与思考
- How to download the software package of CDH version
猜你喜欢

多台云服务器的 Kubernetes 集群搭建

Problem recording and thinking

Why is the frame rate calculated by opencv wrong?

UE4 学习记录二 给角色添加骨架,皮肤,及运动动画

论文笔记: 多标签学习 MSWL

UE4_ Ue5 combines the offline voice recognition plug-in for speech recognition

RepOptimizer: 其实是RepVGG2

电路模块分析练习5(电源)

RK3568+鸿蒙工控板工业网关视频网关解决方案

1281_ FreeRTOS_ Implementation analysis of vtaskdelayuntil
随机推荐
Windows安装Redis及简单使用
【AXI】解读AXI协议原子化访问
Fegin client entry test
Beacon realizes asset management and indoor positioning based on 5.2 ultra-low power Bluetooth module efr32 (bg22ax)
【2023校招刷题】番外篇1:度量科技FPGA岗(大致解析版)
After xampp restarts, the MySQL service cannot be started.
Repoptimizer: it's actually repvgg2
Baidu: in 2022, the top ten hot spots will rise and the profession will be released. There is no suspense about the first place!
电路模块分析练习6(开关)
Several optimization scenarios using like fuzzy retrieval in SQL
Ble Low Power Bluetooth networking process and Bluetooth role introduction
【AXI】解读AXI协议乱序机制
Why is BeanUtils not recommended?
Some points to pay attention to when closing mongodb services (as well as related commands when opening)
最近准备翻译外国优质文章
.sql数据库导入错误:/*!40101 SET @[email protected]@COLLATION_CONNECTION */
Set up your own website (15)
How to download the software package of CDH version
Implementation of sequence table: static and dynamic
MySQL queries data by day, week, month, quarter and year