#include "mainwindow.h"
#include "ui_mainwindow.h"
#include<QPushButton>
#include <QDebug>
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
, ui(new Ui::MainWindow)
{
ui->setupUi(this);
QPushButton* button=new QPushButton(this);
button->setText("按钮");
button->move(200,200);
connect(button,&QPushButton::clicked,this,[button](){//[=]这样可以捕捉上面的所有变量
button->setText("我被按下了!");
});
}
MainWindow::~MainWindow()
{
delete ui;
}