[Qt-interest] QDialog::closeEvent() is called only when a modal dialog is closed by clicking the "X" button

Constantin Makshin cmakshin at gmail.com
Tue Jun 28 16:01:15 CEST 2011


Hello!

I want to save some modal dialog's parameters when it's closed and restore them when it's created/opened again. The obvious way is to save parameters inside the closeEvent() function and restore inside the constructor. This approach works for QMainWindow derivatives but has some weird behavior for modal dialogs — closeEvent() is called only when the dialog is closed by clicking the "X" button or choosing corresponding window context menu item. If the user presses "OK" or "Cancel" button (or takes some other action that's connected to accept() or reject()), closeEvent() is not called, making the dialog-parameter-saving idea mostly useless.

Is this a bug or intended behavior?

Thank you.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: This is a digitally signed message part.
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110628/ffa2ca5c/attachment.bin 


More information about the Qt-interest-old mailing list