Detecting virtual keyboard open and close events in Symbian^3
Article Metadata
Code Example
Article
Applications running on Symbian touch devices may want to react to software input panel (virtual keyboard) state events; for example, to improve user experience by immediately processing the input after virtual keyboard is dismissed. Qt provides QEvent::CloseSoftwareInputPanel event, but it's sent only after the target widget has lost focus.
This code snippet uses QValueSpaceSubscriber to detect virtual keyboard state changes. The code depends on a Publish and Subscribe key that is only available on Symbian^3 platform.
Usage
#include <QValueSpaceSubscriber>
QValueSpaceSubscriber* vkbState = new QValueSpaceSubscriber("/vkb/state", this);
QObject::connect(vkbState, SIGNAL(contentsChanged()), this, SLOT(handleStateChanged()));
Declaring /vkb/state value state path
Create a new .qcrml file, with following content:
<?xml version="1.0" encoding="UTF-8"?>
<repository target="RProperty" version="" uidName="KPSUidAknFep" uidValue="0x100056de">
<key ref="/vkb/state" int="0x00000004"/>
</repository>
Changes to .pro file
Add the following definitions to .pro file:
CONFIG += mobility
MOBILITY += publishsubscribe
symbian: {
crml.pkg_postrules = "\"pskeydefs.qcrml\" - \"c:/resource/qt/crml/pskeydefs_$${TARGET}.qcrml\""
DEPLOYMENT += crml
}
Above solution tries to avoid these problems by modifying the deployed .qcrml filename to include also the name of the application (TARGET), thus making it unique.
Example project
File:Vkbstatetest qtmobility symbian3.zip (can be self-signed, doesn't use any capabilities)

