当前位置:网站首页>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
重新编译生成可执行文件即可
边栏推荐
- Several optimization scenarios using like fuzzy retrieval in SQL
- Count the number of different palindrome subsequences in the string
- No absurd tea applet - rule change
- 头歌 第3关:使用线程锁(Lock)实现线程同步
- The first public available pytorch version alphafold2 is reproduced, and Columbia University is open source openfold, with more than 1000 stars
- 做接口测试,这3种工具到底什么时候用?
- Multi modal data can also be Mae? Berkeley & Google proposed m3ae to conduct Mae on image and text data! The optimal masking rate can reach 75%, significantly higher than 15% of Bert
- 【opencv450-samples】读取图像路径列表并保持比例显示
- 软件测试面试一直挂,面试官总是说逻辑思维混乱,怎么办?
- 【opencv450-samples】inpaint 使用区域邻域恢复图像中的选定区域
猜你喜欢

After xampp restarts, the MySQL service cannot be started.

ES6 -- formal parameter setting initial value, extension operator, iterator, and generating function

Beacon realizes asset management and indoor positioning based on 5.2 ultra-low power Bluetooth module efr32 (bg22ax)

Idea shortcut

CTS RTS RX TX in serial port flow control UART (direct communication between serial port module and MCU)

Konva series tutorial 2: drawing graphics

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

Sword finger offer 46 Translate numbers to strings (DP)

百度:2022年十大热度攀升专业出炉,第一名无悬念!
![[eosio] eos/wax signature error is_ Canonical (c): signature is not canonical](/img/d8/a367c26b51d9dbaf53bf4fe2a13917.png)
[eosio] eos/wax signature error is_ Canonical (c): signature is not canonical
随机推荐
New network security competition of the secondary vocational group in 2022
【opencv450 samples】创建图像列表yaml
汇编语言核心要点
Day4 branch and loop summary and operation
Idea shortcut
Unity technical manual - life cycle rotation rotationoverlifetime- speed rotation rotationbyspeed- and external forces
2、一个向量乘它的转置,其几何意义是什么?
MySQL queries data by day, week, month, quarter and year
Set up your own website (15)
Pointer strengthening and improvement
ACM. HJ16 购物单 ●●
RK3568+鸿蒙工控板工业网关视频网关解决方案
Idea auto generator generates constructor get/set methods, etc
Oracle -- table operation
小程序-视图与逻辑
OBS-Studio-27.2.4-Full-Installer-x64.exe 下载
Some points to pay attention to when closing mongodb services (as well as related commands when opening)
C language (I)
STM32 development board + smart cloud aiot+ home monitoring and control system
Fegin client entry test