Doc - Add tutorials on building and running example applications and creating mobile applications.

Reviewed-by: Christian Kamm
This commit is contained in:
Leena Miettinen
2010-05-28 17:10:03 +02:00
parent 85b165d1cf
commit ea54660fc0
19 changed files with 451 additions and 4 deletions

View File

@@ -0,0 +1,28 @@
#-------------------------------------------------
#
# Project created by QtCreator 2010-05-26T16:46:58
#
#-------------------------------------------------
QT += core gui
TARGET = BatteryIndicator
TEMPLATE = app
SOURCES += main.cpp\
batteryindicator.cpp
HEADERS += batteryindicator.h
FORMS += batteryindicator.ui
CONFIG += mobility
MOBILITY = systeminfo
symbian {
TARGET.UID3 = 0xecbd72d7
# TARGET.CAPABILITY +=
TARGET.EPOCSTACKSIZE = 0x14000
TARGET.EPOCHEAPSIZE = 0x020000 0x800000
}

View File

@@ -0,0 +1,30 @@
#include "batteryindicator.h"
#include "ui_batteryindicator.h"
//! [2]
BatteryIndicator::BatteryIndicator(QWidget *parent) :
QDialog(parent),
ui(new Ui::BatteryIndicator),
deviceInfo(NULL)
{
ui->setupUi(this);
setupGeneral();
}
//! [2]
BatteryIndicator::~BatteryIndicator()
{
delete ui;
}
//! [1]
void BatteryIndicator::setupGeneral()
{
deviceInfo = new QSystemDeviceInfo(this);
ui->batteryLevelBar->setValue(deviceInfo->batteryLevel());
connect(deviceInfo, SIGNAL(batteryLevelChanged(int)),
ui->batteryLevelBar, SLOT(setValue(int)));
}
//! [1]

View File

@@ -0,0 +1,35 @@
#ifndef BATTERYINDICATOR_H
#define BATTERYINDICATOR_H
#include <QDialog>
//! [1]
#include <QSystemInfo>
//! [1]
//! [2]
QTM_USE_NAMESPACE
//! [2]
namespace Ui {
class BatteryIndicator;
}
class BatteryIndicator : public QDialog
{
Q_OBJECT
public:
explicit BatteryIndicator(QWidget *parent = 0);
~BatteryIndicator();
//! [3]
private:
Ui::BatteryIndicator *ui;
void setupGeneral();
QSystemDeviceInfo *deviceInfo;
//! [3]
};
#endif // BATTERYINDICATOR_H

View File

@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>BatteryIndicator</class>
<widget class="QDialog" name="BatteryIndicator">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>800</width>
<height>480</height>
</rect>
</property>
<property name="windowTitle">
<string>BatteryIndicator</string>
</property>
<widget class="QProgressBar" name="batteryLevelBar">
<property name="geometry">
<rect>
<x>10</x>
<y>10</y>
<width>118</width>
<height>23</height>
</rect>
</property>
<property name="value">
<number>24</number>
</property>
</widget>
</widget>
<layoutdefault spacing="6" margin="11"/>
<resources/>
<connections/>
</ui>

View File

@@ -0,0 +1,15 @@
#include <QtGui/QApplication>
#include "batteryindicator.h"
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
BatteryIndicator w;
#if defined(Q_WS_S60)
w.showMaximized();
#else
w.show();
#endif
return a.exec();
}