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,
One is called “ Asking for the train ” A small village Finally got the train Spring Boot Lesson 16 :SpringBoot Implementation of multithreading with injection class Chrome OS, For programmers and Windows What does it mean ? Internet Marketing JAVA Convert a string to a numeric type I've been drinking soft water for three years ? What is the use of soft water and water softener You don't know ——HarmonyOS Talking about uni-app Page value transfer problem JavaScript Medium Call and ApplySparkSQL Achieve partition overlay write Character recognition technology of vehicle license plate based on Neural Network