PDA

View Full Version : close window signal



jano_alex_es
21st May 2009, 14:50
hi, what's the signal emited when the user closes a QDialog by pressing ESC or clicking the upper-right close button?

thanks!

wagmare
21st May 2009, 15:12
hi, what's the signal emited when the user closes a QDialog by pressing ESC or clicking the upper-right close button?

thanks!

reimplement the closeEvent();
void closeEvent(QCloseEvent *event);

inside the virtual function
emit your own signal
ex:
signals:
void dialogClosed();

dialog::closeEvent(QCloseEvent *event)
{
emit dialogClosed();
event->accept();
}

jano_alex_es
21st May 2009, 17:13
it works fine in some forms but in other I have the next error message

"use of undefined type 'QKeyEvent'"

I don't see any diferences between my forms, and the includes are the same... but the wrong ones let me compile if I add the "ui_FormThatWorksOK.h" include :S

spirit
21st May 2009, 19:51
just include #include <QKeyEvent> in cpp-file and add forward declaration class QKeyEvent in h-file.

jano_alex_es
22nd May 2009, 07:43
uop! thanks! But I feel sorry... I paste my message here by mistake :P (it was supossed to be an email!)

anyway, thanks again!

jpn
22nd May 2009, 10:10
See QDialog::rejected().