×
Namespaces

Variants
Actions
(Difference between revisions)

Working with QSystemDisplayInfo - System Information API

From Nokia Developer Wiki
Jump to: navigation, search
hamishwillee (Talk | contribs)
m (Hamishwillee - Bot addition of Template:ArticleMetaData)
hamishwillee (Talk | contribs)
m (Text replace - "<code cpp>" to "<code cpp-qt>")
 
(3 intermediate revisions by one user not shown)
Line 1: Line 1:
 +
[[Category:Qt Mobility]][[Category:Code Examples]]
 
{{ArticleMetaData
 
{{ArticleMetaData
 
|sourcecode=[[Media:SystemDisplayInfo.zip]]  
 
|sourcecode=[[Media:SystemDisplayInfo.zip]]  
 
|installfile= <!-- Link to installation file (e.g. [[Media:The Installation File.sis]]) -->
 
|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'') -->
+
|devices=Nokia 5800 xPressMusic
 
|sdk= <!-- SDK(s) built and tested against (e.g. [http://linktosdkdownload/ Nokia Qt SDK 1.1]) -->
 
|sdk= <!-- SDK(s) built and tested against (e.g. [http://linktosdkdownload/ Nokia Qt SDK 1.1]) -->
|platform= <!-- Compatible platforms - e.g. Symbian^1 and later, Qt 4.6 and later -->
+
|platform=S60 3rd Edition, FP1, FP2<br />S60 5th Edition
 
|devicecompatability= <!-- Compatible devices e.g.: All* (must have internal GPS) -->
 
|devicecompatability= <!-- Compatible devices e.g.: All* (must have internal GPS) -->
 
|dependencies= <!-- Any other/external dependencies e.g.: Google Maps Api v1.0 -->  
 
|dependencies= <!-- Any other/external dependencies e.g.: Google Maps Api v1.0 -->  
|signing=<!-- Signing requirements - empty or one of: Self-Signed, DevCert, Manufacturer -->
+
|signing=Self-Signed
|capabilities=<!-- Capabilities required by the article/code example (e.g. Location, NetworkServices. -->
+
|capabilities=None
|keywords= <!-- APIs, classes and methods (e.g. QSystemScreenSaver, QList, CBase -->
+
|keywords=QSystemDisplayInfo, QString, QButton, QLabel
 
|id= <!-- Article Id (Knowledge base articles only) -->
 
|id= <!-- Article Id (Knowledge base articles only) -->
 
|language=<!-- Language category code for non-English topics - e.g. Lang-Chinese -->
 
|language=<!-- Language category code for non-English topics - e.g. Lang-Chinese -->
Line 18: Line 19:
 
|creationdate=20100310
 
|creationdate=20100310
 
|author=[[User:Kiran10182]]
 
|author=[[User:Kiran10182]]
}}[[Category:Qt Mobility]]
 
{|style="background:#eceff2" width="660px" border="1" cellpadding="5" cellspacing="0"
 
|-
 
|'''ID''' ||
 
|'''Creation date''' || 9-March-2010
 
|-
 
|'''Platform''' || S60 3rd Edition, FP1, FP2
 
S60 5th Edition
 
|'''Tested on devices''' || Nokia 5800 xPressMusic
 
|-
 
|'''Category''' || Qt for Symbian
 
|'''Subcategory''' || Qt Mobility API
 
|-
 
|}
 
 
 
 
{|style="background:#eceff2" width="660px" border="1" cellpadding="5" cellspacing="0"
 
|-
 
|'''Keywords (APIs, classes, methods, functions)''': QSystemDisplayInfo, QString, QButton, QLabel
 
|}
 
 
 
{{Tip|<b></b>
 
* Please read this article before moving forward: [[Setting up environment for Qt Mobility API]]
 
* Setup Carbide.c++ IDE as explained in this article: [[Working with Carbide.c++ IDE for Qt Mobility APIs]]
 
 
}}
 
}}
  
 +
== Overview ==
 +
{{Abstract|This article shows how to use the Qt Mobility System Information API: {{Icode|QSystemDisplayInfo}}.}}
  
= Overview =
+
== What is covered in QSystemDisplayInfo API ==
{{Abstract|This article shows how to use '''''QSystemDisplayInfo API''''' which is a part of the '''''System Information API''''' from '''''Qt Mobility project'''''.}}
+
This article covers information about:
 
+
= What is covered in QSystemDisplayInfo API =
+
* It is a part of the System Information API.
+
* This article covers information about
+
 
** Color depth value of a screen number in bits per pixel
 
** Color depth value of a screen number in bits per pixel
 
** Display brightness of screen in % between 1 - 100 scale.
 
** Display brightness of screen in % between 1 - 100 scale.
  
 
+
== UI design (.ui file)==
 
+
= Capabilities required =
+
* None
+
 
+
 
+
= UI design (.ui file)=
+
 
[[File:QSystemDisplayInfo_UI.PNG]]
 
[[File:QSystemDisplayInfo_UI.PNG]]
  
 
+
== Project configuration file (.Pro file) ==
 
+
Add the Qt Mobility project configuration option in the .Pro file as shown below
= Project configuration file (.Pro file) =
+
<code cpp-qt>
* Add the Qt Mobility project configuration option in the .Pro file as shown below
+
<code cpp>
+
 
CONFIG += mobility
 
CONFIG += mobility
 
MOBILITY += systeminfo
 
MOBILITY += systeminfo
 
</code>
 
</code>
 +
Note, no capabilities are required
  
 
+
== Implementing QSystemDisplayInfo API ==
= Implementing QSystemDisplayInfo API =
+
QSystemDisplayInfo API is a part of the QtMobility namespace. So declare the QtMobility namespace as shown below:
* QSystemDisplayInfo API is a part of the QtMobility namespace. So declare the QtMobility namespace as shown below:
+
<code cpp-qt>
<code cpp>
+
 
using namespace QtMobility;
 
using namespace QtMobility;
 
</code>
 
</code>
  
== Header file==
+
=== Header file===
<code cpp>
+
<code cpp-qt>
 
#ifndef SYSTEMDISPLAYINFO_H
 
#ifndef SYSTEMDISPLAYINFO_H
 
#define SYSTEMDISPLAYINFO_H
 
#define SYSTEMDISPLAYINFO_H
Line 112: Line 77:
  
  
== Source file ==
+
=== Source file ===
<code cpp>
+
<code cpp-qt>
 
#include "SystemDisplayInfo.h"
 
#include "SystemDisplayInfo.h"
  
Line 154: Line 119:
 
</code>
 
</code>
  
= Output =
+
== Output ==
 
[[File:QSystemDisplayInfo_device.jpg]]
 
[[File:QSystemDisplayInfo_device.jpg]]
  
  
  
= Useful functions =
+
== Useful functions ==
 
* int colorDepth ( int screenNumber );
 
* int colorDepth ( int screenNumber );
 
* int displayBrightness ( int screen );
 
* int displayBrightness ( int screen );
 
= Keywords =
 
  
 
==Headers==
 
==Headers==
Line 174: Line 137:
 
* QLabel
 
* QLabel
  
 
+
== Example Application ==
= Example Application =
+
 
* A working example application is available to download from here: [[Media:SystemDisplayInfo.zip|QSystemDisplayInfo.zip]]
 
* A working example application is available to download from here: [[Media:SystemDisplayInfo.zip|QSystemDisplayInfo.zip]]
  
 
+
== Related articles ==
= Related articles =  
+
 
* [[Getting started with Qt Mobility APIs]]
 
* [[Getting started with Qt Mobility APIs]]
 
* [[Setting up environment for Qt Mobility API]]
 
* [[Setting up environment for Qt Mobility API]]
Line 190: Line 151:
 
* [[Working with QSystemNetworkInfo - System Information API - Part 2]]
 
* [[Working with QSystemNetworkInfo - System Information API - Part 2]]
  
= Reference links=
+
== Reference links==
 
* [http://qt.nokia.com/ Qt - cross-platform application and UI framework]
 
* [http://qt.nokia.com/ Qt - cross-platform application and UI framework]
 
* [http://labs.trolltech.com/page/Projects/QtMobility Qt Mobility API]
 
* [http://labs.trolltech.com/page/Projects/QtMobility Qt Mobility API]
 
* [http://qt.nokia.com/developer/qt-roadmap New Qt APIs Beta - Mobility Project]
 
* [http://qt.nokia.com/developer/qt-roadmap New Qt APIs Beta - Mobility Project]
* SDK help[[Category:Code Examples]]
+
* SDK help[[Category:MeeGo Harmattan]] [[Category:Symbian]]

Latest revision as of 04:23, 11 October 2012

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: QSystemDisplayInfo, QString, QButton, QLabel
Created: kiran10182 (10 Mar 2010)
Last edited: hamishwillee (11 Oct 2012)

Contents

[edit] Overview

This article shows how to use the Qt Mobility System Information API: QSystemDisplayInfo.

[edit] What is covered in QSystemDisplayInfo API

This article covers information about:

    • Color depth value of a screen number in bits per pixel
    • Display brightness of screen in % between 1 - 100 scale.

[edit] UI design (.ui file)

QSystemDisplayInfo UI.PNG

[edit] Project configuration file (.Pro file)

Add the Qt Mobility project configuration option in the .Pro file as shown below

CONFIG += mobility
MOBILITY += systeminfo

Note, no capabilities are required

[edit] Implementing QSystemDisplayInfo API

QSystemDisplayInfo API is a part of the QtMobility namespace. So declare the QtMobility namespace as shown below:

using namespace QtMobility;

[edit] Header file

#ifndef SYSTEMDISPLAYINFO_H
#define SYSTEMDISPLAYINFO_H
 
#include <QtGui/QWidget>
#include "ui_SystemDisplayInfo.h"
#include <qsysteminfo.h>
 
using namespace QtMobility;
class SystemDisplayInfo : public QWidget
{
Q_OBJECT
 
public:
SystemDisplayInfo(QWidget *parent = 0);
~SystemDisplayInfo();
 
public slots:
void listDisplayInformation();
void resetAllFields();
 
private:
Ui::SystemDisplayInfo ui;
QSystemDisplayInfo* displayInfo;
};
 
#endif // SYSTEMDISPLAYINFO_H


[edit] Source file

#include "SystemDisplayInfo.h"
 
SystemDisplayInfo::SystemDisplayInfo(QWidget *parent)
: QWidget(parent)
{
ui.setupUi(this);
displayInfo = new QSystemDisplayInfo();
 
QObject::connect(ui.listDisplayInfoButton,
SIGNAL(clicked()),
this,
SLOT(listDisplayInformation()));
QObject::connect(ui.resetButton,
SIGNAL(clicked()),
this,
SLOT(resetAllFields()));
}
 
SystemDisplayInfo::~SystemDisplayInfo()
{
delete displayInfo;
displayInfo = NULL;
}
 
void SystemDisplayInfo::listDisplayInformation()
{
QString colorDepthStr = QString::number(displayInfo->colorDepth(0));
ui.colorDepthLabel->setText(colorDepthStr);
 
QString brightnessStr = QString::number(displayInfo->displayBrightness(0));
ui.brightnessLabel->setText(brightnessStr);
}
 
void SystemDisplayInfo::resetAllFields()
{
ui.colorDepthLabel->clear();
ui.brightnessLabel->clear();
}

[edit] Output

QSystemDisplayInfo device.jpg


[edit] Useful functions

  • int colorDepth ( int screenNumber );
  • int displayBrightness ( int screen );

[edit] Headers

  • #include <qsysteminfo.h>

[edit] Classes

  • QSystemDisplayInfo
  • QString
  • QButton
  • QLabel

[edit] Example Application

[edit] Related articles

[edit] Reference links

This page was last modified on 11 October 2012, at 04:23.
122 page views in the last 30 days.
×