How to disable a window when a new dialog in on top of it?
-
I have mainwindow.ui with some buttons.Finish,Exit,New Dialog etc...
When "New Dialog" is clicked I'm creating a dialog box with "OK" and "Cancel" buttons.This dialog box appears on top of my mainwindow.I have a requirement that, only after user clicks "Ok" or "Cancel" in the dialog the buttons in the mainwindow should be functional otherwise the buttons in the background should not be functional.Please suggest. -
And here is a bit more info on how it works: https://doc.qt.io/qt-5/qt.html#WindowModality-enum
-
@Sriu1
You don't even have to bother to set the modality. Assuming you will useQDialog::exec()
as your way of displaying the dialog, it does all that you want already:exec()
ignores the value of this [modal
] property and always pops up the dialog as modal.