Record the qt Chinese garbled problem and set the icon

Record the qt Chinese garbled problem

After the exe is generated, the exe name and the Chinese in the interface will be garbled. There are many solutions on the Internet. The first one is:
Tools – Options – Text Editor – File Encoding – Default Encoding: UTF-8/UTF-8 BOM: If the encoding is UTF-8, add it. As shown in the figure below: This method does not solve
my
insert image description here
problem

Take another way:

Add in the header file (.h file):

#if defined(_MSC_VER) && (_MSC_VER >= 1600)
# pragma execution_character_set("utf-8")
#endif

successfully solved the problem

By the way, record the way to modify the exe icon (there are many ways, personally think this is the easiest), add the following code in the .pro file (put the name icon in the same level directory as .pro, and the format is .ico file, you can use jpg and other commonly used image format files to find an online conversion website and convert it to .ico format)

# 添加图标
RC_ICONS = icon.ico

Guess you like

Origin blog.csdn.net/qq_43207709/article/details/124145751