How to Handle the Red End Key in a Qt Application

From Qt Wiki
Revision as of 15:46, 14 January 2015 by Maintenance script (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Solution

This requires wrapping the QApplication::symbianEventFilter() function.

This sample shows a simple way of handling the end key so that your application is not quit. It does not prevent the application being closed by the task switcher, and does not interfere with operation of the phone application. Pressing the red key will bring the phone application to the foreground, but leave your application running in the background.

Variants and Extensions

To save state and exit when the red key is pressed, you should instead use the QCoreApplication::aboutToQuit signal, which is cross-platform

Summary

This recipe shows how you handle the red End key in a Qt application.

Note: This article is originally available from symbian foundation wiki: http://developer.symbian.org/wiki/Handle_the_red_End_key_in_a_Qt_application . However, a backup copy has been maintained here as the site would be closed in December. Authored by Orbital AND Hamishwillee. Licensed under the Creative Commons Attribution-Share Alike 2.0 UK: England & Wales License.