添加注释

This commit is contained in:
DevWiki 2023-07-29 21:53:42 +08:00
parent 0713c10b1f
commit b33e7bda36
3 changed files with 17 additions and 1 deletions

View File

@ -1,11 +1,17 @@
// 引入mainwindow的头文件
#include "mainwindow.h" #include "mainwindow.h"
// 引入 QAppliction
#include <QApplication> #include <QApplication>
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
// 实例化一个 QApplication对象
QApplication a(argc, argv); QApplication a(argc, argv);
// 实例化主窗口
MainWindow w; MainWindow w;
// 显示主窗口
w.show(); w.show();
// 返回App执行结果
return a.exec(); return a.exec();
} }

View File

@ -1,10 +1,16 @@
#include "mainwindow.h" #include "mainwindow.h"
#include "./ui_mainwindow.h" #include "./ui_mainwindow.h"
/**
*
* @brief MainWindow::MainWindow
* @param parent Widget
*/
MainWindow::MainWindow(QWidget *parent) MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent) : QMainWindow(parent)
, ui(new Ui::MainWindow) , ui(new Ui::MainWindow)
{ {
//设置Ui组件
ui->setupUi(this); ui->setupUi(this);
} }

View File

@ -7,6 +7,10 @@ QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; } namespace Ui { class MainWindow; }
QT_END_NAMESPACE QT_END_NAMESPACE
/**
* QMainWindow
* @brief The MainWindow class
*/
class MainWindow : public QMainWindow class MainWindow : public QMainWindow
{ {
Q_OBJECT Q_OBJECT