Qt5 modal dialogs stuck behind main window, seems like its hanging
We have an issue with Qt5.1.1 deployed applications on Linux (CentOs & Ubuntu) . We find that the message boxes we show gets sent to the back of the main window when the user clicks on the main window. When you click on a blocked window it should bring the dialog to the front as on Windows. Futhermore, you can resize, minimize etc. the main window while a message box is shown.
Can't think that we are the only ones experiencing this, it seems to be such a basic thing. We've filed "QTBUG-36669":https://bugreports.qt-project.org/browse/QTBUG-36669 but it hasn't gotten any attention since Feb.
Its a real problem for us because users are contacting support saying the application hung on them while we are just showing a simple message box and they accidentally clicked somewhere else on the main window.
Anybody else seen this? Any workarounds?
KashiKyrios last edited by
It would seem you have to manually call setWindowModality(Qt::WindowModal) (or Qt::ApplicationModal), otherwise the dialog is a standard, non modal one (I haven't checked, but it may be OS dependent).
The modality of QDialog is already set to Qt::ApplicationModal by default. We've tried both ApplicationModal and WindowModal without success.
Note that the dialog is modal, the problem is that clicking on the main window causes the dialog to move to the back of it. This is clearly incorrect behaviour.
Did you try ?
@dialog->setWindowFlags(dialog->windowFlags() | Qt::WindowStaysOnTopHint);@
That seems to do the trick. Strange though that its not on by default for Linux but for Windows.
Let me go and add this to each message box...
Thanks for the response.