QDialog

QDialog

QDialog

在这里插入图片描述

QPushButton* P_But(new QPushButton("Creater",this));
connect(P_But,&QPushButton::clicked,[](){
    QDialog* w(new QDialog);
   // 在模块对话框中,exec有自己的消息循环,并且把app
    //  的消息循环给接管了
   w->exec();
});
如果QDialog是通过exec来显示,那么可以通过accept或者Rejected开关闭窗口
如果Dialog是通过show来显示,那么可以通过close来关闭,这个和QWidget一样

猜你喜欢

转载自blog.csdn.net/baidu_41905806/article/details/88998855