issues regarding how to reimplement keyPressEvent()
Dear Friends,
I need to override the Esc key event so i tried to reimplement keyPressEvent() of QDialog. but it is not executed when i pressed any key. the code is given below.
Code:
{
if(e->key()==Qt::Key_Escape)
{
}
else
{
}
}
while defining QDialog i gave setFocusPolicy(Qt::StrongFocus) as like below
Code:
QDialog::setFocusPolicy(Qt
::StrongFocus);
can any body help me where im getting wrong
Re: issues regarding how to reimplement keyPressEvent()
the key event is being received by another widget in your dialog which has input focus.
You should install an evenFilter for that widget in your dialog and there trap the QKeyEvent.