Commit b3f7e503 authored by Arjen Hiemstra's avatar Arjen Hiemstra
Browse files

Properly fix column count and inserting new columns on metadata load

Commit 74db33b1 tried to fix this but did this through always creating
an instance of SensorInfo. This means we never end up inserting new data
in onMetaDataChanged, which breaks the "ready" state of the model and
can lead to an invalid value being produced for the "UpdateInterval"
model role, which means we end up with incorrect chart update rates.

We now use sensorInfos for determining column count and whether or not
the model is ready, which should better reflect the state of the model.

BUG: 433064


(cherry picked from commit 10d8d20a)
parent 496802c2
......@@ -205,7 +205,7 @@ int SensorDataModel::columnCount(const QModelIndex &parent) const
return 0;
}
return d->sensors.count();
return d->sensorInfos.count();
}
qreal SensorDataModel::minimum() const
......@@ -296,7 +296,7 @@ void SensorDataModel::setSensorColors(const QVariantMap &sensorColors)
bool KSysGuard::SensorDataModel::isReady() const
{
return d->sensors.size() == d->requestedSensors.size();
return d->sensors.size() == d->sensorInfos.size();
}
void SensorDataModel::addSensor(const QString &sensorId)
......@@ -433,10 +433,6 @@ void SensorDataModel::Private::sensorsChanged()
sensors = requestedSensors;
for (const auto& sensor : sensors) {
sensorInfos[sensor] = KSysGuard::SensorInfo();
}
SensorDaemonInterface::instance()->subscribe(requestedSensors);
SensorDaemonInterface::instance()->requestMetaData(requestedSensors);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment