Modal QMessageBox does not behave like native Windows dialogs

Posted by Philip Daubmeier on Stack Overflow See other posts from Stack Overflow or by Philip Daubmeier
Published on 2012-10-29T09:33:10Z Indexed on 2012/10/29 11:01 UTC
Read the original article Hit count: 166

Filed under:
|
|
|

My application has a dialog that asks the user via a QMessageBox whether he wants to discard all changes he made or wants to keep editing. I want this dialog to be modal to the whole application.

I read somewhere that this is the standard behavior for a QMessageBox, so I dont have to set it explicitly with something like:

mbox.setWindowModality(Qt::ApplicationModal);

I wonder why it behaves differently from other modal dialogs in the OS (Windows 7 in my case). On the one hand it functions like it should, i.e. all other input methods in the application are blocked until the user answeres the dialog. However, it doesn't 'blink'* if the user clicks any other window of the application. Is there any way to get Qt to behave like a native Windows dialog?

Thanks in advance!


*If you don't know what I mean with this 'blinking': Just open notepad on a Windows OS, type some text and try to close it. A dialog pops up that asks to save, discard or keep editing. Now click somewhere on the editor window -> the border and titlebar of the dialog flashes/blinks a few times.

© Stack Overflow or respective owner

Related posts about c++

Related posts about qt