View Full Version : How to make modal widget wait for input after it is shown.

17th December 2010, 04:40
I have a QWidget derived object, and "setWindowModality(Qt::WindowModal)" to it.
Then I call "show()", however, the process did not get blocked there, although the widget is modal indeed.

What I want is, how to make it work like "CDialog:: DoModal()" in MFC, the process will not go further until the dialog is dismissed.

17th December 2010, 06:31
maybe you need to call exec instead of show

17th December 2010, 06:45
It seems QWidget doesn't have "exec()" :(

17th December 2010, 06:53
according to QT document,
Qt::WindowModal only makes sense for windows,so you can use isWindow () to check whether it is a window not not, if not , show will not block

17th December 2010, 07:12
How about deriving from QDialog rather than QWidget?