QT realizes serial debugging assistant (1)

 

1. Install the QTCreator
official website and install it yourself , the community version is enough


Second, the compiler

If there is no special compiler requirement, you can directly use the built-in MinGW 32-bit compiler, or you can install Visual Studio to configure and use its compiler, which can compile 64-bit. The compiler will automatically detect it. It is recommended to install Visual Studio first. QT will automatically recognize it during installation.

Three, create a new project

Set project name and path

Set up the compiler

Set up basic classes and UI

The above can be left alone, just use the default ones.

The final generated project file is as follows:

The .pro file describes the import relationship of cpp and h files and the loading of modules

mainwindow.h and mainwindow.cpp are the UI program entrances

mianwindow.ui is an xml, which describes the UI style and content of the main window, which can be edited with the designer

Simply analyze the process of generating the UI interface:

Through compilation, QT will convert the xml content of mianwindow.ui into ui_mainwindow.h file, so that the C++ compiler can recognize and instantiate the graphics.

Through the constructor of MainWindow, call setupUi in UI_mianwindow to instantiate the main window

In mian.cpp, MainWindow is instantiated and the show function is called

The program starts to execute through the main function entry, so the UI interface is displayed

At last

return a.exec();

The program enters the message waiting, waiting for the message event to occur and generate a response

 

 

 

Guess you like

Origin blog.csdn.net/zhangfls/article/details/108965272