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.
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.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With