QDialog is a modal dialog box that is much like a QMessageBox or an editable QMessageBox. It can be modal or be a simple message box. When a QDialog is created, it can be immediately shown using the exec() function.
The setModal() function is used to set whether the QDialog is modal or not. If the argument is true, the QDialog is modal; otherwise, it is not. It is recommended that modal dialogs are used sparingly, as they can be disruptive to the user’s workflow.
Example 1: Setting a QDialog to Modal
To set a QDialog to modal, you can use the setModal() function. The following code sets a QDialog to modal:
QDialog dialog; dialog.setModal(true);
Example 2: Setting a QDialog to Non-Modal
You can also set a QDialog to non-modal by using setModal() and passing false as the argument:
QDialog dialog; dialog.setModal(false);
Package Library: Qt Language: C++
C++ (Cpp) QDialog::setModal - 30 examples found. These are the top rated real world C++ (Cpp) examples of QDialog::setModal extracted from open source projects. You can rate examples to help us improve the quality of examples.