Qt application development - download and install and HelloWorld

Table of contents

1. Download and install

2、HelloWorld


1. Download and install

        If a worker wants to do a good job, he must first sharpen his tools. The first step is to install the environment is a necessary process. Qt has been updated to 6.5.0 in April 23. Compared with other tools, Qt is very friendly in that it is constantly being maintained and upgraded. Here we will not introduce the iterative update content of the version. For application development, the newer version is definitely the best. Each version downloaded from the official website provides installation packages for windows, linux, and IOS systems. Windows is used as an example here, and the installation on other platforms is similar. There are many installation tutorials, so I won’t go into details here.

         Qt5.9.6 installation tutorial

         The blogger is using 5.9.6, and the official website of the offline package is currently offline.

Link: https://pan.baidu.com/s/18QOuBErSb6ScRVjAS-ESZg
Extraction code: qd5p

2、HelloWorld

              Let's start learning from QtWidget first. The first program starts from the output of HelloWorld, select file-new file or project-select Application-Qt Widget Application, select Choose....74fd620246724ed3b6a624aeeba8cc15.png

        Edit the project name and the path created. It should be noted that Chinese or special characters cannot appear.

71a7ae5100144fd6aa3d115ee95175df.png

         Select the next step, the desktop program is checked by default

3c938ae27d7d49d09a79317b31e0c999.png

 

        Select the next step, and the creation interface is checked by default. The default file names here are all lowercase, and the beginning of the word of the class name is capitalized. If you feel uncomfortable, you can modify it here.

317721bffe9a42d297e23d0814aba106.png

         Select the next step. If the version control does not have git, the default is none. We will introduce the follow-up version control in the topic.

ee5133d28f4b4836b24fb387d1e07159.png

        Select Done. Part of the code has been created by Qt Creator, and the project structure is also very clear. Headers places .h files, Sources places cpp files, Forms places UI interface files, and Resource places resource files.

f66337efc5fd4cf189ca084eb428cce7.png

         Click on the left column - project, here is some configuration information of the project, and the build directory stores the compiled files of the software.

6ba7d195173342499ef8a370f46c52de.png

        Double-click mainwindow.ui, the Qt designer interface will be embedded in Qt Creator, and we can directly edit the interface file. The left side is the graphics control that comes with the system, and the bottom right is the control's properties. Try to drag the label control to the interface, double-click to change the text label to Hello World, and change the font size in the font property in the bottom right corner.

9bf9f5452bb64c90b52016cb35ab4db8.png

         Select Edit to return to the code interface, and you will find that the operation just now will be converted into xml interpretation, including coordinates, size, and text labels.

64f6a9062f014a08867d1cb61d37caf7.png

         Right-click the project to select build (compile), or click the small hammer in the lower left corner to compile

e1507bcaa819425eac44a19d0f74fb73.png                         ab1896bcaf974e6baa3fcfa4a84ed9be.png

         Select compile output in the lower right corner to see the compilation process, and there is a build progress bar in the lower right corner, which means success.

eefc5ea8b8b941d692a220c749258181.png

        Right-click the project and select Run or the right-pointing triangle in the lower left corner of the interface to run and view the results. The second one with small bugs is to debug and run.

b25a08509f2f4725abcb70e56e028254.png

 

Guess you like

Origin blog.csdn.net/u014491932/article/details/131738523