[Qt-interest] [qt4] QDialog closing question

Jaime Fernandez j.fernandez at midimesures.fr
Thu Jun 18 15:11:30 CEST 2009


Hello,

Thank you for the answer but obviously, my question wasn't clear.
I want to prevent someone to close my dialog by pressing the espace button.
I use the closeEvent function from QWidget to catch all the close event 
requests (ALT+F4, etc...) but it doesn't work with the escape key.
Any explanation ?

hiral a écrit :
> Hi,
> yes u need to handle the Esc key and bind it with the whatever 
> function you want, here u can call the QApplication::postEvent(obj, 
> QCloseEvent());.
> Thank you.
>
>
>  
> On Thu, Jun 18, 2009 at 5:37 PM, Jaime Fernandez 
> <j.fernandez at midimesures.fr <mailto:j.fernandez at midimesures.fr>> wrote:
>
>     Hello,
>
>     To catch the closing event in a QDialog class based, I use the
>     closeEvent function.
>     closeEvent isn't called if I press the Escape key on my keyboard while
>     executing the dialog.
>     Why is the reason to this feature ?
>     If I want to prevent this, should I have to use the keyPressEvent
>     function on my dialog ?
>     Regards,
>     _______________________________________________
>     Qt-interest mailing list
>     Qt-interest at trolltech.com <mailto:Qt-interest at trolltech.com>
>     http://lists.trolltech.com/mailman/listinfo/qt-interest
>
>




More information about the Qt-interest-old mailing list