Home · All Classes · Annotated · Functions

Keypad Architecture

Introduction

Keypad Architecture

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

For a tutorial discussing adding a keyboard driver plugin 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 sets out the codes that are required / available / 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

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

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 a 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 without:

and Qtopia can operate with Key_Menu rather than Key_Context.

If a device has an alternate button mapping, Trolltech will endeavour to provide assistance in getting Qtopia to work with alternate button mapping.

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 plugin 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 can do a keyboard grab to get these keys.

Keys That Are Sometimes Intercepted

While the screen lock is active (SIM card pin required for example) 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 © 2006 Trolltech Trademarks
Qtopia 4.1.7