Qt的控制台qtcreator_process_stub(Xterm)不顯示中文 解決

來源:互聯網
上載者:User

        當用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

帶!的表示屏蔽掉了,大家根據自己情況,如果需要的話再配置。

上張:

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.