PDA

View Full Version : How catch keypress event from hardware button for the whole application



hubbobubbo
29th April 2010, 11:29
Hi

I am working on a mobile application and I need to know when the user presses one of the physical buttons on the phone. I do not want this detection to be dependent on which Widget that is currently displayed or has the focus. Is there any way to detect keypress on application level independent on which is the currentl widget??

It seems a bit hard to do installEventFilter on all of my Widgets, there must be a better way.

hubbobubbo
29th April 2010, 12:29
So I did install an event filter on my MainWindow class and I do think this one catches most of it. However if I understand correctly, if for instance a tree view also catches events this will override the filter in the MainWindow.

The other question is really if there is a way to catch the button press when the application Window is not in focus or does this have to be done nativly on each platform, mostly interesint here are the mobile platforms like Symbian,

MasterBLB
29th April 2010, 12:39
As far as I remember mobile Qt applications uses QwxServer or somesuch.If I were you I'd try to reimplement the server event() function.