PDA

View Full Version : prob with keyPressEvent()



Askar
14th December 2009, 08:36
Dear Friends,
I need to filter Esc key in Dialogs, i had reimplemented keyPressEvent(QKeyEvent *) just below,
but its not working



void myCLass::keyPressEvent(QKeyEvent *e)
{
if(e->key()==Qt::Key_Escape)
{
e->ignore();
}
else
{
QDialog::keyPressEvent(e);
}
}

i have set Focus Policy in my dialog object

win = new QDialog(this);
win->setFocusPolicy(Qt::StrongFocus);

can any body help me t o fix this problem

spirit
14th December 2009, 08:40
I think you should reimplement QDialog::reject.

Askar
14th December 2009, 08:42
I think you should reimplement QDialog::reject.

can u tell how ....?

spirit
14th December 2009, 08:47
...
void MyDialog::reject()
{
//do something...
}
...