forked from qt-creator/qt-creator
Doc - Add tutorials on building and running example applications and creating mobile applications.
Reviewed-by: Christian Kamm
This commit is contained in:
28
doc/examples/batteryindicator/BatteryIndicator.pro
Normal file
28
doc/examples/batteryindicator/BatteryIndicator.pro
Normal 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
|
||||
}
|
||||
30
doc/examples/batteryindicator/batteryindicator.cpp
Normal file
30
doc/examples/batteryindicator/batteryindicator.cpp
Normal 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]
|
||||
35
doc/examples/batteryindicator/batteryindicator.h
Normal file
35
doc/examples/batteryindicator/batteryindicator.h
Normal 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
|
||||
33
doc/examples/batteryindicator/batteryindicator.ui
Normal file
33
doc/examples/batteryindicator/batteryindicator.ui
Normal 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>
|
||||
15
doc/examples/batteryindicator/main.cpp
Normal file
15
doc/examples/batteryindicator/main.cpp
Normal 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();
|
||||
}
|
||||
Reference in New Issue
Block a user