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.
Qt Code:
  1. void Myclass::keyPressEvent(QKeyEvent *e)
  2. {
  3. if(e->key()==Qt::Key_Escape)
  4. {
  5. QMessageBox(0,"Error","Key press");
  6. }
  7. else
  8. {
  9. QDialog::keyPressEvent(e);
  10. }
  11. }
To copy to clipboard, switch view to plain text mode 


while defining QDialog i gave setFocusPolicy(Qt::StrongFocus) as like below
Qt Code:
  1. win = new QDialog(this);
  2. QDialog::setFocusPolicy(Qt::StrongFocus);
To copy to clipboard, switch view to plain text mode 

can any body help me where im getting wrong