QDialog dialog; dialog.setAttribute(Qt::WA_DeleteOnClose);
QDialog dialog; dialog.setAttribute(Qt::WA_ShowModal, true);In this example, we set the attribute of the dialog to be modal, meaning it will block user interaction with other windows until it is closed. The second parameter of the setAttribute method indicates whether the modal attribute should be set to true or false. Package library: Qt