|
1Qter豆
QPushButton *btn_Start = new QPushButton(this); btn_Start->setText(tr("开始游戏"));// btn_Start->resize(30,20); btn_Start->setGeometry(ui->centralWidget->width()/2-30,ui->centralWidget->height()/2-15,60,30); connect(btn_Start,SIGNAL(clicked()),this,SLOT(StartGame())); connect(btn_Start,SIGNAL(clicked()),btn_Start,SLOT(deleteLater()));}
MainWindow::~MainWindow(){ delete ui;}
void MainWindow::StartGame(){ QPushButton *btn_Restart = new QPushButton(this); btn_Restart->setGeometry(ui->centralWidget->width()/2-30,ui->centralWidget->height()/2-15,60,30); btn_Restart->setText(tr("重新开始")); qDebug()<<"生成按钮";}
并不能生成新按钮
|
|