blob: 8ddb69590a6f95503abceaf9e7e9276b958ed96b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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]
|