My first Qt Project!
This commit is contained in:
30
mainwindow.cpp
Normal file
30
mainwindow.cpp
Normal 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);
|
||||
}
|
||||
Reference in New Issue
Block a user