Embedded Linux GUI basics - packaging and deployment of QT programs

I. Overview

If a program written in Qt is not packaged and deployed, the program can only be run in the Qt environment. Therefore, if we want to publish the written program to other users, we must package and deploy the program so that they can run the program without relying on the Qt environment, and at the same time, the written source code can be well processed. Protect.

Note: This blog post is based on the previous blog post: Embedded Linux GUI Basics - QQ Login Interface Example - CSDN Blog https://blog.csdn.net/Eva20192020/article/details/134540896?spm=1001.2014.3001.5502

based on packaging and deployment.

2. Packaging and deployment

1. Switch mode

The first step is to switch the project to release mode before compiling.

Release mode: basically no debugging information.

debug mode: There is a lot of debugging information.

The specific operation is as shown below. The project name here is MYQQ. Switchdebug mode to release mode.

2. Find the folder built in release mode

After switching, run the program in release mode, and the result is that it can run normally. After running, find the root directory where the Qt project is located, and find the release folder as shown below.

Entering its inner layer, we can see an executable file QQ.exe, but this file cannot be opened yet, as shown below.

 3. Modify icon

First add the icon to the folder where the project is located. This process will not be explained here, as it has been explained in detail in the previous article. The result after adding is as shown below.

Then add in the pro file: RC_ICONS=QQ.ico , where the icon file name is QQ.ico as shown below.

 Note: The format of the icon must be .ico, other formats are not acceptable.

Go to the release folder again and check the icon of the generated executable MYQQ.exe. It has changed, as shown below.

4. Packet operation

The packet operation requires the use of the Qt console. Click Start on the Windows desktop or search for Qt, as shown below:

Click on the above Qt console, as shown below.

 

Before packaging, first create a dynamic library and exe file to store the required files. As long as it is not a Chinese path (the desktop is not a Chinese path), here we create the MYQQ folder on the desktop and add the MYQQ.exe generated by the release in the project. Copy it to this folder, as shown below.

 

 

 Inside the Qt console. We use the command to enter the path where our newly created folder is located. The command is as follows.

 

Use the dir command to check that the MYQQ.exe file exists in the folder, as shown below.​ 

 

After that, we use the windeployqt tool to add the library to our newly created folder. as follows:

Format: windeployqt MYQQ.exe // Add the name of the exe file to the packet command, as shown below.

The result after success is as follows:

 

 So far, the packet has been successfully sealed.

 

Guess you like

Origin blog.csdn.net/Eva20192020/article/details/134601347