tags:

views:

1488

answers:

2

Hi!

I want to create a Qt popup window which will behave like a message box in Qt. That means the rest of the GUI must blocked until that popup window is dismissed. This may be a child question, but can anyone pls help me with this ?

Thanks... :)

Edit:

I want to use forms, labels, buttons and some other widget types in that popup window.

A: 

You can use QMessageBox.

sepp2k
Hey! I want to use forms and some other widget types.. Can I do those with QMessageBox ??????? And also I know what QMessageBox is, but I didn't know Modal Dialogs. I hope my question is clear enough you !!!!!!!!!!! thanks
Morpheus
+9  A: 

Modal Dialogs

A modal dialog is a dialog that blocks input to other visible windows in the same application. Users must finish interacting with the dialog and close it before they can access any other window in the application. Dialogs that are used to request a file name from the user or that are used to set application preferences are usually modal.

The most common way to display a modal dialog is to call its exec() function. When the user closes the dialog, exec() will provide a useful return value. Typically, to get the dialog to close and return the appropriate value, we connect a default button, e.g. "OK", to the accept() slot and a "Cancel" button to the reject() slot. Alternatively you can call the done() slot with Accepted or Rejected.

An alternative is to call setModal(true) or setWindowModality(), then show(). Unlike exec(), show() returns control to the caller immediately. Calling setModal(true) is especially useful for progress dialogs, where the user must have the ability to interact with the dialog, e.g. to cancel a long running operation. If you use show() and setModal(true) together to perform a long operation, you must call QApplication::processEvents() periodically during processing to enable the user to interact with the dialog. (See QProgressDialog.)

m3rLinEz
Thanks for the guide..I'll try it..
Morpheus
yeah...that is what I want. Thank you very much..
Morpheus