Qt的控制台qtcreator_process_stub(Xterm)不显示中文 解决

        当用Qt的qtcreator建纯C/C++项目时,qt会调用一个控制台,类似windows下的console。默认状态下是不显示中文的,NND。Google了一圈无解。

        求人不如求己啊!记得最初启动qt的这个控制台时,qt提示没有Xterm。也就是说Qt调用的控制台是Xterm,参照配置Xterm的两篇文章:http://blog.sina.com.cn/s/blog_6a75ed3d0100p10b.html

http://tieba.baidu.com/p/1798593957

Xterm的配置文件在一个叫Xresources的文件里,首先切换到root,然后locate Xresources,看到文件路径在:/etc/X11/Xresources;

 

[root@localhost ~]# gedit /etc/X11/Xresources
打开后,默认的配置内容是:

! 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*faceName:Monospace:antialias=True:pixelsize=15

运行:[root@localhost ~]# xrdb   /etc/X11/Xresources
使配置文件生效就可以让qt的qtcreator_process_stub正常显示中文了!

      但是这个时候,跳出来的控制台太宽了很不美观,添加这句设置宽和高:

xterm*geometry: 50x24

即宽为50,高为24.

为了保险起见,加了这句:

xterm*faceNameDoublesize:WenQuanYi Zen Hei:antialias=True:pixelsize=15

这是来设置字体的,用的系统的文泉驿,系统自带的哦!

总结:添加的配置语句有下面红色三句,改好后一定要#xrdb   /etc/X11/Xresources。


!font and locale

!xterm*locale: true
!xterm.utf8:     true
!xterm*utf8Title: true
 
!xterm*fontMenu*fontdefault*Label: Default

xterm*geometry: 50x24
xterm*faceName:Monospace:antialias=True:pixelsize=15

!xterm*boldFont:Sans:style=Bold:pixelsize=13
xterm*faceNameDoublesize:WenQuanYi Zen Hei:antialias=True:pixelsize=15
!xterm*xftAntialias: true
!xterm.cjkWidth:true
!XTerm*preeditType: Root

带!的表示屏蔽掉了,大家根据自己情况,如果需要的话再配置。

上张截图:


  • 1
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 3
    评论
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值