The dialog box is divided into
modal dialog box ( You cannot operate on other windows )
modeless dialog box ( You can operate on other windows )
#include "mainwindow.h" #include "ui_mainwindow.h" #include "QDialog" #include
"QDebug" MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) , ui(new
Ui::MainWindow) { ui->setupUi(this);
connect(ui->actionnew,&QAction::triggered,[=](){ // modal dialog box QDialog *dlg=new
QDialog(this); dlg->resize(300,200); dlg->exec();// block qDebug()<<" modality "; }); }
MainWindow::~MainWindow() { delete ui; }
Modal dialog through
dlg->exec();// block
1. Block to that line of code

At this time, click new to run without any output
2.

After closing , The following code is executed , And print it out

Two , modeless dialog box
#include "mainwindow.h" #include "ui_mainwindow.h" #include "QDialog" #include
"QDebug" MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) , ui(new
Ui::MainWindow) { ui->setupUi(this);
connect(ui->actionnew,&QAction::triggered,[=](){ // modeless dialog box QDialog *dlg2=new
QDialog(this); dlg2->resize(300,200); dlg2->show();
dlg2->setAttribute(Qt::WA_DeleteOnClose); qDebug()<<" Non modal "; }); }
MainWindow::~MainWindow() { delete ui; }
After operation

Technology
©2019-2020 Toolsou All rights reserved,
【 Explain in detail 】 Interview must ask :SpringBoot Automatic configuration principle 【 Hyper detail 】Java Realization of student information management system 2020 The 11th National Blue Bridge Cup Python group JavaScript note ( five )---- Branch statement MYSQL database SQL Sentence practice experiment EXERCISES. 1 SIMPLE COMMANDSMySQL Basics Commonly used sentence ( Add / delete / modify query )C++ of string of compare usage vue limit input Only positive numbers can be entered C Language of a Gobang game implementation Programmer refused due to low salary offer,HR become shame , Netizens instantly blew up ..