qwsEventFilter implementation
I try to intercept keyboard events using qwsEventFilter. First of all I must mention that currently I use Qt-creator on X86 Ubuntu and may be this causes problems..
What I did:
myapp.h
Code:
{
public:
MyApp
(int &argc,
char **argv
) : QApplication( argc, argv
) {};
};
myapp.cpp
Code:
#include "myapp.h"
{
if(e
->type
== QEvent::KeyPress) { qDebug("pressed");
}
else if (e
->type
== QEvent::KeyRelease ) { qDebug("released");
}
return false;
}
main.c
Code:
#include <QtGui/QApplication>
#include "myapp.h"
#include "qt-linphone.h"
int main(int argc, char *argv[])
{
MyApp a(argc, argv);
Widget w;
w.show();
return a.exec();
}
if I run the application with -qws and then hit any button on a keyboard I don't see "pressed"/"released". What is wrong with my code? May be Qt creator can handle QWS related code? Anyway I tried to use x11EventFIlter and it didn't even compile because of absence of XEvent definition..
Re: qwsEventFilter implementation
First of all why you are trying to use qws? Second of all you need to install the event filter on some object to be able to filter events for it.
Re: qwsEventFilter implementation
I use qws because my target application is run by -qws on ARM platform.
I tried to install filters for specific objects, but I need first to process user input before to send events to the Qt core
Re: qwsEventFilter implementation
After manual compilation of Qt-everywhere-4.7.2 by arm-linux-gnueabi compiler and running an application with "-qws" parameter the event handler:
Code:
{
qDebug("key");
}
return false;
}
..works as expected.