Hi!

I'm running a simple command line application based on QCoreApplication and for some reason I am not receiving keyboard inputs. When in run this program in the command line on Linux using ./Application, I can see the keys that I press on the keyboard and but there is no reaction from the keyPressEvent. Can anyone point out where my mistake is?

Qt Code:
  1. int main(int argc, char *argv[])
  2. {
  3. QCoreApplication a(argc, argv);
  4. Application w;
  5. a.installEventFilter(&w);
  6. return a.exec();
  7. }
To copy to clipboard, switch view to plain text mode 

Qt Code:
  1. class Application : public QObject
  2. {
  3. Q_OBJECT
  4.  
  5. public:
  6. Application(QObject *parent = 0);
  7. ~Application();
  8.  
  9. protected:
  10. void keyPressEvent(QKeyEvent *event);
  11. };
  12.  
  13. void Application::keyPressEvent(QKeyEvent *event)
  14. {
  15. qDebug() << "keyPressEvent event occured" << event; // This is never printed.
  16. }
To copy to clipboard, switch view to plain text mode