Commit 10d8d20a 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
parent 0cf97bf5
......@@ -206,7 +206,7 @@ int SensorDataModel::columnCount(const QModelIndex &parent) const
return 0;
}
return d->sensors.count();
return d->sensorInfos.count();
}
qreal SensorDataModel::minimum() const
......@@ -297,7 +297,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)
......@@ -434,10 +434,6 @@ void SensorDataModel::Private::sensorsChanged()
sensors = requestedSensors;
for (const auto& sensor : sensors) {
sensorInfos[sensor] = KSysGuard::SensorInfo();
}
SensorDaemonInterface::instance()->subscribe(requestedSensors);
SensorDaemonInterface::instance()->requestMetaData(requestedSensors);
......
Supports Markdown
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