OESF | ELSI | pdaXrom | OpenZaurus | Zaurus Themes | Community Links | Ibiblio

IPB

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Capture Harware Button Events in Qtopia?
doc
post Apr 5 2004, 06:30 PM
Post #1





Group: Members
Posts: 191
Joined: 16-March 04
From: Indianapolis
Member No.: 2,346



Hey any Qtopia experts out there can tell me how to capture the hardware button events in a program...like the rocker button(s) mainly?

Any example code?

Thanks.
Go to the top of the page
 
+Quote Post
ashikase
post Apr 5 2004, 09:29 PM
Post #2





Group: Members
Posts: 280
Joined: 17-March 04
From: Osaka, Japan
Member No.: 2,375



You probably will want to take a look at QWidget::keyPressEvent():
http://doc.trolltech.com/2.3/qwidget#0a4482

Also maybe QObject::eventFilter():
http://doc.trolltech.com/2.3/qobject#bd20fe

If you look around the QObject and QWidget doc pages, you'll find an example or two of capturing keys.

One thing to note is that whatever widget is in focus will receive the event first (before its parent). Say you have a QWidget with a QFrame in it, and a QLineEdit inside the QFrame, and the QLineEdit has focus. When you press a key, the QLineEdit will receive the event first. It can then either eat the event (stop it, thus preventing the parent from seeing it) or pass it on to the parent.

Some widgets eat quite a few keystrokes, such as QTable, and the parent never sees them... this is where eventFilter can come in handy. EventFilter can intercept events being sent to another widget.

Hope that helps.
Go to the top of the page
 
+Quote Post
lpotter
post Apr 5 2004, 11:46 PM
Post #3





Group: Members
Posts: 451
Joined: 27-November 03
From: Brisbane, Australia
Member No.: 1,001



You might also possibly want to look at QPEApplication::grabKeyboard() and QPEApplication::ungrabKeyboard()
Go to the top of the page
 
+Quote Post
dz
post Apr 6 2004, 03:15 AM
Post #4


~


Group: Admin
Posts: 596
Joined: 2-February 04
From: Cape Canaveral, FL
Member No.: 1,667



Ha, on the front page, the title is 'Capture Harware Butt'

sorry.. just found it amusing
Go to the top of the page
 
+Quote Post
doc
post Apr 6 2004, 05:16 AM
Post #5





Group: Members
Posts: 191
Joined: 16-March 04
From: Indianapolis
Member No.: 2,346



Thanks guys. I got it, now I'm going to try cranking out another app for golf scores.

Touche dz.
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic
2 User(s) are reading this topic (2 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 23rd October 2014 - 01:17 PM