QT's default font is actually MS Shell DLG 2

Source: Internet
Author: User

The default font under WIN10 is actually the Segoe UI, which causes different versions of Windows to appear inconsistent, so you can modify the default font for Windows (which takes effect after a reboot):

[hkey_local_machine>>software>>microsoft>>windowsnt>>currentversion>> Fontsubstitutes:segoe UI = Tahoma]

However, it is best to specify the display font for the software itself so that it can be controlled so that the global font is set:

Qfont font;font.setfamily ("MS Shell Dlg 2"//  Tahoma Arial qapp- >setfont (font);

To detect a global font:

Qdebug () << qapp-><< qapp-><< qapp-><< qapp->  << qapp-><< qapp->font (). key ();

Output Result:

"Unknown"
"MS Shell DLG 2"
"Arial"
""
"MS Shell Dlg 2,8.25,-1,5,50,0,0,0,0,0"
"MS Shell Dlg 2,8.25,-1,5,50,0,0,0,0,0"

---------------------------------------------------------------------

In addition, the font can be taken as a resource file, and then used, for example, I think Microsoft Black is good:

Pass the font file name to Addapplicationfont to get the font ID
int fontid = Qfontdatabase::addapplicationfont ("./res/msyh.ttf");
Pass the font ID to applicationfontfamilies and get a qstringlist, where the first element is the newly added font family
QString msyh = qfontdatabase::applicationfontfamilies (Fontid). at (0);
Qfont font (msyh,10);
Set this font to the default font for Qapplication
Qapplication::setfont (font);

---------------------------------------------------------------------

Qfont provides font for drawing text
Qfontcombobox provides a drop-down list box for selecting font families
Qfontdatabase provides fonts that can be used under the Windows operating system
Qfontdialog is used to select a specified font
Qfontengineinfo is used to describe a specified font engine plug-in
Qfontengineplugin tired provides the base of the font warehouse plug-in for embedded Linux
Qfontinfo contains general information about a font
Qfontdialog used to pop up a dialog box to get the specified font

---------------------------------------------------------------------

Reference:
Http://mobile.51cto.com/symbian-272552.htm (there is also a series of articles below)
http://blog.csdn.net/Liuqz2009/article/details/7208637

Qt's default font is actually MS Shell DLG 2

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.