Solve Linux/ubuntu qt creater Interface program after the compilation run can not display Chinese or Chinese garbled problem!

Source: Internet
Author: User

This article is mainly to solve the interface program compile and run after the problem can not display Chinese, if in creater can not input Chinese, download a ibus or sogou, such as Chinese input method can be solved!

First of all, the problem of garbled, this is a good solution:

If it is under the Linux open Windows under the project garbled, choose the code as "GB2312" Can!

Now the main point is that the program can not be displayed after the Chinese or garbled, the problem has been plagued by this issue for a long time, online to see a lot of information posts are not resolved, all the added are added have no way,

Http://bbs.csdn.net/topics/390610841?page=1 follow all the methods in this post to solve the problem is not successful.

I use the version is QT-EVERYWHERE-OPENSOURCE-SRC installed 4.8.1 and 4.8.5, just started to install is 8.5, see the post there is said to appear unable to display Chinese is this version of the bug, so installed a 8.1 but still did not solve

(embarrassed ...). )。 The installation method is: http://blog.csdn.net/willib/article/details/21968937

There is a lack of Chinese fonts on the Internet, but it is not, perhaps just as careless as I am ...

Terminal Open QT configuration: qtconfig


Select fonts, next, please look carefully family: in the font, carefully, in fact, there are Chinese fonts, but it is used pinyin, such as: Fangsong Ti,song Ti, choose one, remember to click on the file

Save the noodles! Such as:

Next, add the header file in the main file #include <qtextcodec>, and then in Qapplication a (argc, argv); After adding QTEXTCODEC::SETCODECFORTR (Qtextcodec::codecforname ("GB2312"));

O, the original only display English can not display Chinese and Chinese characters are solved together!

Summary: A lot of problems, in fact, not as hard as they think, do things carefully!!!



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.