I published the QT version a few days ago and found that the image was not displayed. Later I found that there was no Image Library added! Find it and go to the QT installation package. I installed it on drive F:/QT/plugins and found plugins. There is
Imageformats is the image library, which contains jpg and GIF files. You can add images in that format! Note that you should test the imageformats folder to the current folder of your program! Add qapplication: addlibrarypath ("./plugins") to the main function ");
In this way, your release version with images will be ready!
Let's take a look at the DLL that is generally needed for the release version (usually generate release!
The Chinese font is garbled after it is published. The solution is similar to the image. Find plugins first, find codecs, and create the piugins folder in the current folder of your program, copy the codecs folder to the piugins folder and add it to the main function:
Qapplication: addlibrarypath ("./plugins ");
Qtextcodec: setcodecforlocale (qtextcodec: codecforname ("gb2312 "));
Qtextcodec: setcodecfortr (qtextcodec: codecforname ("gb2312 "));
Qtextcodec: setcodecforcstrings (qtextcodec: codecforname ("gb2312 "));
(Windows is gb2312; Linux is gb2312/UTF-8; arm board with UTF-8, and to set the font, generally with wenquanyi)
After finishing the picture and font, how can we add the sound? See the phonon_backend folder. This is the sound! First of all, let's explain the sound of QT. There are two ways to add sound in QT. The simplest thing is to use qsound,
Qsound A ("bomb.wav ");
A. Play ();
If you use qsound, you can simply use it without adding any more to the release version. However, this qsound does not seem to boast of the platform! It is not easy to use in Linux! (NAS is said to have to be installed, and it is difficult for me to install it! And the arm board cannot be installed !) So we have to use phonon. This phonon is quite tangled. I will talk about it for a moment, because it seems that this library is not available before qt4.5, and no phonon is used by default during cross-compilation, with it, compilation will cause many problems! Let's talk about windows first. poonon is very powerful. It can play audio and video files ~! After using phonon in the window, make the release version. First, you must go to F:/QT/bin to find
Put it in your executable program folder, and then go to F:/QT/plugins to find plugins,
Like the image, put phonon_backend in the folder of your executable program. Do not forget to add qapplication: addlibrarypath ("./plugins") in the main function ");
(If you do not add)
Let's take a look at the released version of all the images!