QDialog
-
I have QDialog class, inside the class I have one line edit and one push button. My sequence of QDialog opening is, first I will open one main window then, there I will click one pushbutton, it will open one more widget, inside that widget I have search option, if I click search option that time this QDialog will appear. If QDialog is visible I need to disable QMainWindow and Qwidget. That means QDialog should behave like QMessage box. Once I close QDialog after that only I can able to access QMainWindow and Qwidget. Any one can suggest how to do this. Thanks in advance.
-
Hi
QDialog will do this automatically for you if you use exec() to show it.so when search options is clicked() and you say
Mydialog dia;
dia.exec(); <<< stays in here and mainwindow should be blocked.its called a modal dialog.
more info here
http://doc.qt.io/qt-5/qdialog.html#modal-dialogs -
@m.sue
Hi
The docs says
exec() ignores the value of this property and always pops up the dialog as modal.http://doc.qt.io/qt-5/qdialog.html#modal-prop
So using exec() should be enough. But always good to know about
setModal :)