Reputation: 739
I have two QMainWindows. I would like when a QMessageBox is displayed on a QMainWindow with an exec(), the other QMainWindow isn't blocked.
The two QMainWindow must be independent.
How do this ?
Upvotes: 0
Views: 171
Reputation: 4085
It has nothing to do with QThread, the Qt documentation states that you can have only ONE GUI thread in a QT application.
What you should do is to set the modality flag to make the dialog modal, so it will be modal related to its parent window. Before executing the dialog, call:
pDialog->setWindowModality( Qt::WindowModal );
And don't forget to set a proper parent for your dialog object.
Qt documentation states: -
Modal Dialogs
A modal dialog is a dialog that blocks input to other visible windows in the
same application. Dialogs that are used to request a file name from the user or
that are used to set application preferences are usually modal. Dialogs can be
application modal (the default) or window modal.
Upvotes: 2
Reputation: 4350
Use the show()
method to display each QMainWindow
instead of exec()
.
Upvotes: 0