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.
QDialog will do this automatically for you if you use exec() to show it.
so when search options is clicked() and you say
dia.exec(); <<< stays in here and mainwindow should be blocked.
its called a modal dialog.
more info here
You will need to make the dialog modal
The docs says
exec() ignores the value of this property and always pops up the dialog as modal.
So using exec() should be enough. But always good to know about
I used setModal(true). It is working for me. Thank you very much.
Thanks for your help.