The two days have been using QT to implement a cross-platform software. The software was previously written on Windows and later put into Ubuntu 10.10 under compilation. The program runs with a very difficult problem, the interface text is very vague. Later on the internet for several days of information, experienced countless experiments, and finally solved the problem. The following is a demo program to reproduce the problem.
The compiler platform in this article is: Ubuntu 10.10 x86 version, g++ 4.4.5, Qt 4.7.3 own compiled
First look at the blur of my demo program text:
The text of a software interface is not acceptable at all in this way.
Some people say to change the default font through Qtconfig, but I have modified many times, are unsuccessful, or so.
Finally find the reason, first of all I put QT in linux default font "AR PL UKai CN" Set dead, as shown in:
Why is it that the setting is dead? Look at the lower right corner, the font family row, the small arrow at the end of the line is red, which means the property is not currently the default value, and if it is the default, the small arrow should be grayed out. To solve the problem of font blur, the first step should be the interface on all settings of the dead font family back to the default value, just select the part you want to change the font family, on the right to the list of properties click the red to the small arrow, make it gray, so you can set the default value.
In the second step, enter "Qtconfig" (without quotation marks) in the terminal to open the Qt Configurator, as shown in:
On the right side of the second tab "Font" we can see that the font family is currently "AR PL UKai CN", in the "sample text" below we can also see that these words are also very vague, we click on the font family right to the upper and lower arrows, pop-up font family selection list, as shown in:
Because our goal is not only to display English, but also to display Chinese, so we choose "Song Ti" (Arial) this item, and then modify the point size of 11, at this time "sample text" is much clearer. As shown in the following:
Once the settings are complete, click on the "File" menu and select "Save" to save the current configuration as shown in:
You should now see the changed effect immediately, as shown in:
Qt Configurator interface font has become much clearer, then our program is not also changed it? Take a look, as shown in:
From what we can see, the font is also very clear in our own program interface, in order to verify the compatibility of Chinese, I also entered a number of characters in the text edit part, also no problem, the font is still clear. Throughout the process, in addition to the first step to modify the default font after recompiling the program, after modifying the QT configuration and no need to recompile the program. The font of the program interface has changed.
It is important to note that the Qtconfig tool only exists under Linux, and that there is no such tool in the QT Library of Mac version, but there is definitely no in Windows. In addition, the font family I set in the Qtconfig tool is "Song Ti", which is not clear when the "dot size" is less than 11th. A friend who needs a smaller font can set the font family to "Wenquanyi Bitmap song" (Bitmap-based Wen Quan shu-Arial), which can still be displayed clearly when the font is set to a small font size.
http://blog.csdn.net/chaijunkun/article/details/6448295
QT Application font blur solution in Linux environment (first change to use default font, then use Qtconfig configuration)