×
Namespaces

Variants
Actions
(Difference between revisions)

Get System Info programmatically in Qt

From Nokia Developer Wiki
Jump to: navigation, search
kiran10182 (Talk | contribs)
m
hamishwillee (Talk | contribs)
m (Text replace - "<code cpp>" to "<code cpp-qt>")
 
(7 intermediate revisions by one user not shown)
Line 1: Line 1:
[[Category:Qt Mobility]]
+
[[Category:Qt Mobility]][[Category:Code Examples]]
{{CodeSnippet
+
{{Abstract|This code example shows how to get system information programmatically in Qt using {{Qapiname|QSysInfo}}.}}
|id=...
+
 
|platform=S60 3rd Edition, FP1, FP2<br>S60 5th Edition
+
{{ArticleMetaData <!-- v1.1 -->
 +
|sourcecode= [[Media:QtSystemInfo.zip]]
 +
|installfile= <!-- Link to installation file (e.g. [[Media:The Installation File.sis]]) -->
 
|devices= Nokia 5800 XpressMusic
 
|devices= Nokia 5800 XpressMusic
|category=Qt
+
|sdk= <!-- SDK(s) built and tested against (e.g. [http://linktosdkdownload/ Nokia Qt SDK 1.1]) -->
|subcategory= UI
+
|platform= S60 3rd Edition, FP1, FP2<br>S60 5th Edition
|creationdate=June 16, 2009
+
|devicecompatability= <!-- Compatible devices (e.g.: All* (must have GPS) ) -->
|keywords=QSysInfo::s60Version (), QSysInfo::symbianVersion ()
+
|dependencies= <!-- Any other/external dependencies e.g.: Google Maps Api v1.0 -->
 +
|signing= Self Signed
 +
|capabilities= None
 +
|keywords= QSysInfo
 +
|id= <!-- Article Id (Knowledge base articles only) -->
 +
|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= 20090616
 +
|author= [[User:Savaj]]
 
}}
 
}}
 
{{ReviewerApproved}}
 
  
 
==Overview==
 
==Overview==
  
This code snippets shows how to get system information programmatically in Qt. The QSysInfo class provides information about the system. The QSysInfo has two static method, s60Version() and symbianVersion(), which gives information about system. Then method s60Version () returns the version of the S60 SDK system on which the application is run. The method symbianVersion () returns the version of the Symbian operating system on which the application is run.
+
The {{Icode|QSysInfo}} class provides information about the system. The {{Icode|QSysInfo}} has two static method, {{Icode|s60Version()}} and {{Icode|symbianVersion()}}, which gives information about system. Then method {{Icode|s60Version()}} returns the version of the S60 SDK system on which the application is run. The method {{Icode|symbianVersion()}} returns the version of the Symbian operating system on which the application is run.
 
+
This snippet can be self-signed. As it does not use any API which require developer/certified signing.
+
 
+
==Preconditions==
+
 
+
* Download and Install latest version [[Qt for Symbian - Installation packages]] which has links on how to install the latest version
+
  
 
==Headers required==
 
==Headers required==
<code cpp>
+
<code cpp-qt>
 
  #include <QSysInfo>
 
  #include <QSysInfo>
 
</code>
 
</code>
  
 
==Source==
 
==Source==
<code cpp>
+
<code cpp-qt>
 
void SystemInfo::GetSystemInfo()
 
void SystemInfo::GetSystemInfo()
 
{
 
{
Line 140: Line 148:
 
==Code Example==
 
==Code Example==
  
* The [[Media:QtSystemInfo.zip|Code Example]] will show S60 version and Symbian OS version of device and is tested on Nokia 5800 XpressMusic.
+
* [[File:QtSystemInfo.zip]] shows S60 version and Symbian OS version of device and is tested on Nokia 5800 XpressMusic.[[Category:MeeGo Harmattan]] [[Category:Symbian]]
 
+
[[Category:Code Examples]]
+

Latest revision as of 04:23, 11 October 2012

This code example shows how to get system information programmatically in Qt using QSysInfo.

Article Metadata
Code ExampleTested with
Devices(s): Nokia 5800 XpressMusic
Compatibility
Platform(s): S60 3rd Edition, FP1, FP2
S60 5th Edition
Symbian
Platform Security
Signing Required: Self Signed
Capabilities: None
Article
Keywords: QSysInfo
Created: savaj (16 Jun 2009)
Last edited: hamishwillee (11 Oct 2012)

Contents

[edit] Overview

The QSysInfo class provides information about the system. The QSysInfo has two static method, s60Version() and symbianVersion(), which gives information about system. Then method s60Version() returns the version of the S60 SDK system on which the application is run. The method symbianVersion() returns the version of the Symbian operating system on which the application is run.

[edit] Headers required

 #include <QSysInfo>

[edit] Source

void SystemInfo::GetSystemInfo()
{
//Get S60 version and display it on label
switch (QSysInfo::s60Version ())
{
case QSysInfo::SV_S60_3_1:
{
ui.label->setText("S60 version: S60 3.1");
}
break;
case QSysInfo::SV_S60_3_2:
{
ui.label->setText("S60 version: S60 3.2");
}
break;
case QSysInfo::SV_S60_5_0:
{
ui.label->setText("S60 version: S60 5.0");
}
break;
case QSysInfo::SV_S60_Unknown:
{
ui.label->setText("S60 version: S60 Unknown");
}
break;
default:
break;
}
 
//Get OS version and display it on label
switch (QSysInfo::symbianVersion ())
{
case QSysInfo::QSysInfo::SV_9_2:
{
ui.label_2->setText("Symbian OS version: 9.2");
}
break;
case QSysInfo::SV_9_3:
{
ui.label_2->setText("Symbian OS version: 9.3");
}
break;
case QSysInfo::SV_9_4:
{
ui.label_2->setText("Symbian OS version: 9.4");
}
break;
case QSysInfo::SV_Unknown:
{
ui.label_2->setText("Symbian OS version: Unknown");
}
break;
default:
break;
}
 
}

[edit] S60 version defined in Qt

Constant Description
QSysInfo::SV_S60_3_1 S60 3rd Edition Feature Pack 1
QSysInfo::SV_S60_3_2 S60 3rd Edition Feature Pack 2
QSysInfo::SV_S60_5_0 S60 5th Edition
QSysInfo::SV_S60_Unknown An unknown and currently unsupported platform

[edit] Symbian OS version defined in Qt

Constant Description
QSysInfo::SV_9_2 Symbian OS 9.2
QSysInfo::SV_9_3 Symbian OS 9.3
QSysInfo::SV_9_4 Symbian OS 9.4
QSysInfo::SV_Unknown An unknown and currently unsupported platform

[edit] Postconditions

The code snippet is expected to show S60 version and Symbian OS version on screen.

SystemInfo.JPG

[edit] External Links

[edit] Code Example

  • File:QtSystemInfo.zip shows S60 version and Symbian OS version of device and is tested on Nokia 5800 XpressMusic.
This page was last modified on 11 October 2012, at 04:23.
115 page views in the last 30 days.
×