Get System Info programmatically in Qt
kiran10182
(Talk | contribs) m |
hamishwillee
(Talk | contribs) m (Add Abstract. Point to correct Qt SDK) |
||
| Line 7: | Line 7: | ||
|subcategory= UI | |subcategory= UI | ||
|creationdate=June 16, 2009 | |creationdate=June 16, 2009 | ||
| − | |keywords=QSysInfo | + | |keywords=QSysInfo |
}} | }} | ||
| − | {{ReviewerApproved}} | + | {{ReviewerApproved|timestamp=20090913}} |
==Overview== | ==Overview== | ||
| − | This code | + | {{Abstract|visible=true|This code example shows how to get system information programmatically in Qt using [http://doc.qt.nokia.com/stable/qsysinfo.html QSysInfo].}} |
| − | This snippet can be self-signed | + | 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. | ||
==Preconditions== | ==Preconditions== | ||
| − | * Download and | + | * Download and install the [[Qt SDK]] |
==Headers required== | ==Headers required== | ||
| Line 140: | Line 142: | ||
==Code Example== | ==Code Example== | ||
| − | * | + | * [[File:QtSystemInfo.zip]] shows S60 version and Symbian OS version of device and is tested on Nokia 5800 XpressMusic. |
[[Category:Code Examples]] | [[Category:Code Examples]] | ||
Revision as of 03:12, 26 April 2011
Article Metadata
Tested with
Devices(s): Nokia 5800 XpressMusic
Compatibility
Platform(s): S60 3rd Edition, FP1, FP2
S60 5th Edition
S60 5th Edition
Article
Keywords: QSysInfo
Created: (16 Jun 2009)
Last edited: hamishwillee
(26 Apr 2011)
Contents |
Overview
This code example shows how to get system information programmatically in Qt using QSysInfo.
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.
This snippet can be self-signed.
Preconditions
- Download and install the Qt SDK
Headers required
#include <QSysInfo>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;
}
}
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 |
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 |
Postconditions
The code snippet is expected to show S60 version and Symbian OS version on screen.
External Links
- QSysInfo: QSysInfo reference
Code Example
- File:QtSystemInfo.zip shows S60 version and Symbian OS version of device and is tested on Nokia 5800 XpressMusic.

