QT Version: 4.4.1
OS: RHEL 5

I am attempting to create a console application that uses QLocalServer/QLocalSocket for interprocess communication.

In the program, I stay in the event loop waiting for connections.

If the user presses a key, I want to exit the program.

I have remplemented the eventFilter method and added a installEventFilter(this) call to the constructor of the SNOOPER class:

Qt Code:
  1. class SNOOPER: public QObject
  2. {
  3. Q_OBJECT
  4.  
  5. public:
  6. SNOOPER(QString sIP); // Constructor
  7. ~SNOOPER(); // Destructor
  8. ...
  9.  
  10. bool eventFilter( QObject *o, QEvent *e );
  11.  
  12. public slots:
  13. void connectClient();
  14. void readParts();
  15. };
  16.  
  17. bool SNOOPER::eventFilter( QObject *o, QEvent *e )
  18. {
  19. bool bRval = false;
  20.  
  21. if (e->type() == QEvent::KeyPress)
  22. {
  23. qDebug("KeyPress event detected.");
  24. bRval = true;
  25. exit(0);
  26. }
  27. else
  28. {
  29. qDebug("Non-KeyPress event detected.");
  30. }
  31. return bRval;
  32. }
To copy to clipboard, switch view to plain text mode 
I received the following output when I run the program, but I do not get any key events:

Qt Code:
  1. Non-KeyPress event detected.
  2. Non-KeyPress event detected.
To copy to clipboard, switch view to plain text mode 
Please let me know what I am missing.

Thanks!
Karl