首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > 移动开发 >

Qt的控制台qtcreator_process_stub(Xterm)不显示汉语 解决

2012-09-07 
Qt的控制台qtcreator_process_stub(Xterm)不显示中文解决当用Qt的qtcreator建纯C/C项目时,qt会调用一个控

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: hintmediumXft.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

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

上张截图:

Qt的控制台qtcreator_process_stub(Xterm)不显示汉语  解决


热点排行