中标麒麟V7中的Qt5.9.2中CONFIG += console不显示中文的问题

在中标麒麟V7系统中,使用Qt Create 4.1.0(基于Qt 5.9.2)开发时遇到CONFIG += console配置后控制台无法输出中文的问题。解决方法包括修改Qt相关文件,添加支持中文的字体设置,如添加“方正楷体_GBK”,并执行命令重新加载字体。参考多个技术博客完成修复。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

环境

1、中标麒麟V7

2、系统自带的Qt Create 4.1.0(Based on Qt 5.9.2 (GCC 4.9.2 20141101 (NeoKylin 4.9.2-1), 64 bit))

3、.pro文件中配置了 CONFIG += console后控制台输不出中文的问题

解决方法

1、打开以下文件:

/etc/X11/Xresources

2、添加以下二行代码即可,其中字体“方正楷体_GBK”可执行 “fc-list”查看本机字体替换:

! This is the global resources file that is loaded when
! all users log in, as well as for the login screen

! Fix the Xft dpi to 96; this prevents tiny fonts
! or HUGE fonts depending on the screen size.
Xft.dpi: 96

! hintstyle: medium means that (for Postscript fonts) we
! position the stems for maximum constrast and consistency
! but do not force the stems to integral widths. hintnone,
! hintslight, and hintfull are the other possibilities.
Xft.hintstyle: hintmedium
Xft.hinting: true

!添加以下二行即可
xterm*faceNameDoublesize:方正楷体_GBK:antialias=True:pixelsize=15
xterm*faceName:Consolas:
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值