My first Qt Project!

This commit is contained in:
2025-05-27 17:13:43 +08:00
commit 0c4eef6396
6 changed files with 184 additions and 0 deletions

30
mainwindow.cpp Normal file
View File

@ -0,0 +1,30 @@
#include "mainwindow.h"
#include "./ui_mainwindow.h"
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
, ui(new Ui::MainWindow)
{
ui->setupUi(this);
hello();
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::hello()
{
auto btn = new QPushButton(this);
btn->setText("Exit");
btn->connect(btn, &QPushButton::clicked, this, &MainWindow::Exit);
}
void MainWindow::Exit()
{
exit(0);
}