Hi

This is driving me nuts, so hopefully someone has the answer.

I am re-implementing QApplication to filter all mouse and keyboard events to a widget which is embedded into a tk application.
tk does not pass on focus properly and the tk app needs some crucial keystrokes forwarded, so I have to check everything
including checking which child widget is the receiver and forcing focus in some instances.

I just finished dealing with mouse clicks and went to add keystrokes

Qt Code:
  1. bool FilterApplication::notify( QObject *receiver, QEvent *event )
  2. {
  3. if(event->type() == QEvent::MouseButtonPress)
  4. qDebug() << "Button Pressed";
  5. if(event->type() == QEvent::KeyRelease)
  6. qDebug() << "Key Released";
  7.  
  8. .......
  9.  
  10. }
To copy to clipboard, switch view to plain text mode 

The test for mouse events is fine, but when I try to do the same for key press / release events I get

FilterApplication.cpp: In member function ‘virtual bool FilterApplication::notify(QObject*, QEvent*)’:
FilterApplication.cpp:33:29: error: expected unqualified-id before numeric constant
FilterApplication.cpp:33:29: error: expected ‘)’ before numeric constant
make: *** [FilterApplication.o] Error 1


I can cast the event eg.

Qt Code:
  1. QKeyEvent *K = (QKeyEvent*)event;
  2. if (K->key() == Qt::Key_Escape)
  3. qDebug() << "Escape Pressed";
To copy to clipboard, switch view to plain text mode 

That works fine, except that I get 3 key codes instead of 1 for release and I am casting and testing stuff that isn't key events

Hopefully something simple, but my head is scrambled trying to find it.

Qt 4.8 on Linux

regards