Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries. Thanks for all your past and future contributions.
Show the installed Qt and Qt Mobility version on Symbian and Maemo / MeeGo
On the mobile platforms (Symbian and Maemo / MeeGo), Qt is installed only once on the system and all apps link to it dynamically. As a developer dealing with many different devices and Qt versions, it's often needed to quickly find out which Qt and Qt Mobility version is currently installed on a device. Use this QtVersionInfo tool to get a quick overview of the device environment.
Note that this example is built with Qt, so it only works on a device that already has Qt and Qt Mobility installed. Some Symbian^3 devices have Qt 4.6 pre-installed, but not the full Qt Mobility package, which is required to query the version information.
The example zip file therefore contains an installation package with the Smart Installer, which takes care of setting up Qt and Qt Mobility on the phone prior to installing the Qt Version Info tool (qtversioninfo_installer.sis). If you know that you already have Qt and Qt Mobility installed on the device, you can go for the non-Smart Installer package (qtversioninfo.sis).
Querying the Qt version
Getting the Qt version on a device requires Qt Mobility. The SystemInfo module has a method to get information about the Qt version, the device firmware version and the operating system. Qt Mobility 1.1 also adds a method to query the version of the Qt Mobility module. To make the tool as flexible as possible, it always queries the mobility version info with a fixed constant value. If the phone has an old mobility release installed and is not capable of returning the mobility version, the app will get an empty string back and therefore assume that it's running with a 1.0.x Qt Mobility release.
// The Qt Mobility version can only be queried with Mobility 1.1+
#if (QTM_VERSION >= QTM_VERSION_CHECK(1, 1, 0))
// This is only executed when compiling with Mobility 1.1
// Doesn't relate to what is installed on the device, only the dev environment.
// Libs installed on the device don't return the version -> has to be 1.0.x mobiltiy
// Best situation: got the mobility version directly, so show it to the user
// Not most safe or elegant conversion, but works as the si.version returns
// an empty string if an unknown enum value is passed.
// Compiling with Mobility 1.0 libs, but the phone has the new mobility version installed
Import the test app to your Qt Creator as part of the (Nokia) Qt SDK. The package also contains a pre-compiled .sis-file that you can directly install to your phone. File:QtVersionInfo.zip
A further developed example that prints even more information about the Qt installation can be downloaded from Nokia Developer Projects