Home · All Classes · Grouped Classes · Annotated · Functions

Keypad Architecture

Introduction

Keypad Architecture

For an overview on character input in Qtopia Core see : Qtopia Core Character Input.

For a tutorial discussing adding a keyboard driver plug-in see : Tutorial: Implementing a Device Plug-in

Default Scan-codes for Qtopia Keys

Nearly all PDAs and Phones have keys that are not found on a regular keyboard. In order for Qtopia to function correctly when installed on a device, it needs these keys to be defined. The easiest way to do this is to have the keyboard driver for the device emit the scancodes for the existing mapping for Qtopia.

In addition to the normal mapping for a US-101 keyboard, the following table defines the codes that are either required, available or optional:

ScancodeQt Key CodeDescriptionKeypad Modeno keypad mode
"65"Key_MenuApplication menu keyOptionalNot Available
"67"Key_BackAccept/Close dialog keyRequiredNot Available
"68"Key_YesYesOptionalNot Available
"69"Key_NoNoOptionalNot Available
"87"Key_CallStart call, accept incoming callOptionalNot Available
"88"Key_HangupEnd call, reject incoming callOptionalNot Available
"116"Key_SelectSelect menu option, checkbox, pressbuttonRequiredNot Available
"120"F31Toggle input methodOptionalOptional
"121"F32Sync deviceOptionalOptional
"122"F34Power/SleepOptionalRequired
"123"F35Toggle backlightOptionalOptional
"124"Context1First Context buttonOptionalNot Available
"125"Context2Second Context buttonOptionalNot Available
"126"Context3Third Context buttonOptionalNot Available
"127"Context4Fourth Context buttonOptionalNot Available

Two additional keys are listed below for reasons of compatibility. They do not have default mappings, and should not be used.

Qt key codeDescriptionKeypad ModeNo Keypad Mode
Key_F30maps to space on widgets that need a select keyNot ApplicableOptional
Key_F33maps to enter on widgets that need an Ok keyNot ApplicableOptional

Qtopia is designed to be flexible in terms of the keys required, the default mapping for Qtopia has the following keys:

Key NameDescription
Key_Selectselects/activates/toggles/edits the currently highlighted item.
Key_Context1soft key 1; mapped to Key_Menu in default mapping.
Key_Backleave dialog, or Key_Backspace while editing text and no real Key_Backspace.
Key_Callanswer or make a call.
Key_Hanguphang up a call or return to home screen.
Key_Upnavigate to previous item, or up one line.
Key_Downnavigate to next item, or down one line.
Key_Leftnavigate to previous page in Tab Widget, or left one character.
Key_Rightnavigate to next page in Tab Widget, or left one character.
Key_Flippressed and held while the display is closed (eg. Clamshell phone), released when open. Answers or hangs up calls.
Key_Backspacedeletes character/item.

Note: Qtopia can operate with Key_Menu rather than Key_Contex and without:

Trolltech will endeavor to provide assistance for alternate device button mappings.

Overriding the Keyboard Handler Qtopia Keys

If your device does not already have a Qt keyboard driver or it does not emit standard scancodes then a custom Qt keyboard driver will be required.

Drivers can be added by deriving from the QWSMouseHandler and QMouseDriverPlugin classes, or the QWSKeyboardHandler and QKbdDriverPlugin classes, and using Qt's plug-in mechanism. See the How to Create Qt Plugins documentation and the Plug & Paint example for details.

Key Behavior in Qtopia

Keys That Are Always Intercepted

Some keys are always intercepted before they reach an application. If a pointer device is available an application perform a keyboard grab to obtain these keys.

Keys That Are Sometimes Intercepted

While the screen lock is active, for example when a SIM card PIN is required, the applications will only be allowed keys such as Key_Back and Key_No. This is to reduce the chance of anyone accessing the phone's data while the SIM-card PIN is still required.


Copyright © 2007 Trolltech Trademarks
Qtopia 4.2.5