Set QFile parents

This commit is contained in:
Matti Viljanen 2019-02-10 20:30:26 +02:00
parent 8d9516a494
commit a9daef7d6b
No known key found for this signature in database
GPG key ID: CF32A1495158F888

View file

@ -20,11 +20,11 @@
Battery::Battery(QObject* parent) : QObject(parent)
{
// Number: meaning percentage, e.g. 42
chargeFile = new QFile("/run/state/namespaces/Battery/ChargePercentage");
chargeFile = new QFile("/run/state/namespaces/Battery/ChargePercentage", this);
// Number: 0 or 1
chargingFile = new QFile("/run/state/namespaces/Battery/IsCharging");
chargingFile = new QFile("/run/state/namespaces/Battery/IsCharging", this);
// String: charging, discharging, (empty), unknown (others?)
stateFile = new QFile("/run/state/namespaces/Battery/ChargingState");
stateFile = new QFile("/run/state/namespaces/Battery/ChargingState", this);
// TODO
// What if the files can't be opened?