PDA

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



cuiqimeng
17th December 2010, 03: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.

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

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

hashb
17th December 2010, 05: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

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