Namespaces

Variants
Actions

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 over the next few weeks. Thanks for all your past and future contributions.

Show the installed Qt and Qt Mobility version on Symbian and Maemo / MeeGo

From Wiki
Jump to: navigation, search
Article Metadata
Code ExampleCompatibility
Platform(s):
Symbian
Article
Created: ajakl (25 Feb 2011)
Last edited: kiran10182 (31 Oct 2013)

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).

QtVersionInfo.png

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.

QSystemInfo si;
ui->versionQt->setText(si.version(QSystemInfo::QtCore));
 
// 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.
if (si.version(QSystemInfo::QtMobility).isEmpty())
{
// Libs installed on the device don't return the version -> has to be 1.0.x mobiltiy
ui->versionMobility->setText("1.0.x");
}
else
{
// Best situation: got the mobility version directly, so show it to the user
ui->versionMobility->setText(si.version(QSystemInfo::QtMobility));
}
#else
// Not most safe or elegant conversion, but works as the si.version returns
// an empty string if an unknown enum value is passed.
if (si.version((QSystemInfo::Version)4).isEmpty())
{
ui->versionMobility->setText("1.0.x");
}
else
{
// Compiling with Mobility 1.0 libs, but the phone has the new mobility version installed
ui->versionMobility->setText(si.version((QSystemInfo::Version)4));
}
#endif
 
ui->versionOS->setText(si.version(QSystemInfo::Os));
ui->versionFW->setText(si.version(QSystemInfo::Firmware));


Test application

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

This page was last modified on 31 October 2013, at 19:25.
154 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×