×
Namespaces

Variants
Actions
(Difference between revisions)

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

From Nokia Developer Wiki
Jump to: navigation, search
ajakl (Talk | contribs)
 
hamishwillee (Talk | contribs)
m (Hamishwillee - Bot update - Add ArticleMetaData)
(7 intermediate revisions by 2 users not shown)
Line 1: Line 1:
[[Category:Maemo]][[Category:MeeGo]][[Category:Qt]][[Category:Qt for Maemo]][[Category:Qt for Symbian]][[Category:Qt Mobility]][[Category:Symbian]][[Category:Tools]]
+
{{ArticleMetaData <!-- v1.2 -->
 +
|sourcecode= [[Media:QtVersionInfo.zip]]  
 +
|installfile= <!-- Link to installation file (e.g. [[Media:The Installation File.sis]]) -->
 +
|devices= <!-- Devices tested against - e.g. ''devices=Nokia 6131 NFC, Nokia C7-00'') -->
 +
|sdk= <!-- SDK(s) built and tested against (e.g. [http://linktosdkdownload/ Qt SDK 1.1.4]) -->
 +
|platform= <!-- Compatible platforms - e.g. Symbian^1 and later, Qt 4.6 and later -->
 +
|devicecompatability= <!-- Compatible devices e.g.: All* (must have internal GPS) -->
 +
|dependencies= <!-- Any other/external dependencies e.g.: Google Maps Api v1.0 -->
 +
|signing= <!-- Signing requirements - empty or one of: Self-Signed, DevCert, Manufacturer -->
 +
|capabilities= <!-- Capabilities required by the article/code example (e.g. Location, NetworkServices. -->
 +
|keywords= <!-- APIs, classes and methods (e.g. QSystemScreenSaver, QList, CBase -->
 +
|language= <!-- Language category code for non-English topics - e.g. Lang-Chinese -->
 +
|translated-by= <!-- [[User:XXXX]] -->
 +
|translated-from-title= <!-- Title only -->
 +
|translated-from-id= <!-- Id of translated revision -->
 +
|review-by= <!-- After re-review: [[User:username]] -->
 +
|review-timestamp= <!-- After re-review: YYYYMMDD -->
 +
|update-by= <!-- After significant update: [[User:username]]-->
 +
|update-timestamp= <!-- After significant update: YYYYMMDD -->
 +
|creationdate= 20110225
 +
|author= [[User:Ajakl]]
 +
}}
 +
[[Category:Qt]][[Category:Qt Mobility]][[Category:Tools]][[Category:MeeGo Harmattan]][[Category:Symbian]]
 
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.
 
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.
  
Line 6: Line 28:
 
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).
 
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).
  
[[Image:QtVersionInfo.png]]
+
[[File:QtVersionInfo.png]]
  
 
==Querying the Qt version==
 
==Querying the Qt version==
Line 53: Line 75:
 
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.
 
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]]
 
[[File:QtVersionInfo.zip]]
 +
 +
A further developed example that prints even more information about the Qt installation can be downloaded from [https://projects.developer.nokia.com/qtinfo/ Nokia Developer Projects]
 +
[[Category:Code Examples]]

Revision as of 15:14, 24 July 2012

Article Metadata
Code ExampleCompatibility
Platform(s):
Symbian
Article
Created: ajakl (25 Feb 2011)
Last edited: hamishwillee (24 Jul 2012)

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

350 page views in the last 30 days.