First a warning.... not all buttons are connected to the system in the same manner. If you lucky the platform exposes the button as an input device mapped to a key.

Ok... now if you are lucky enough to have the power button for your specific device mapped to some key, you can use XGrabKey from a process inside the user session but without active keyboard focus (like a homescreen running in the desktop.) This isn't a Qt mechanism but a low level XLib call.

On a linux workstation run 'man XGrabKey' to learn all about it.

    --rusty

On 01/24/2011 05:51 PM, zhu wrote:
I think the question is
" How to get the keypressevent when the application is not
active(don't have the focus widget) "


On Tue, Jan 25, 2011 at 9:41 AM, Zhang, Zheng<[email protected]>  wrote:
Write a Qt application, get keyPressEvent(QKeyEvent* event). event->key().



From: [email protected] [mailto:[email protected]] On
Behalf Of Zheng, Huan
Sent: Monday, January 24, 2011 4:44 PM
To: [email protected]; [email protected] community
Subject: [MeeGo-dev] How can i detect power button press



Hi, dear developers

How can I detect power button press?

And further more, how can I detect the button press that I’m interested in?

Thanks!

_______________________________________________
MeeGo-dev mailing list
[email protected]
http://lists.meego.com/listinfo/meego-dev


_______________________________________________
MeeGo-dev mailing list
[email protected]
http://lists.meego.com/listinfo/meego-dev

_______________________________________________
MeeGo-dev mailing list
[email protected]
http://lists.meego.com/listinfo/meego-dev

Reply via email to