void MainWindow::on_pushButton_clicked()
{
//模态
QDialog dlg(this);
dlg.resize(100,100);
dlg.exec();
qDebug()<<"hello world";
//非模态
QDialog *dlg2=new QDialog(this);
dlg2->resize(200,200);
//释放内存, 当点击关闭的时候
dlg2->setAttribute(Qt::WA_DeleteOnClose);
dlg2->show();
qDebug()<<"hello world2";
}
/// 消息对话框
QMessageBox::question(this,"","",QMessageBox::Save|QMessageBox::Cancel);
标签:模态,200,dlg2,dlg,QT,对话框,100,resize
From: https://blog.51cto.com/u_4018548/6420082