Bug 469234 - SensorDataModel: MetaData never update if sensors set when disabled
Summary: SensorDataModel: MetaData never update if sensors set when disabled
Status: RESOLVED UNMAINTAINED
Alias: None
Product: ksysguard
Classification: Unmaintained
Component: general (other bugs)
Version First Reported In: 5.27.4
Platform: Manjaro Linux
: NOR minor
Target Milestone: ---
Assignee: KSysGuard Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-05-01 13:31 UTC by orblazer
Modified: 2024-09-23 21:00 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description orblazer 2023-05-01 13:31:28 UTC
SUMMARY
When we create QML object `SensorDataModel` and we set `sensors` with `enabled` set to false, the sensors MetaData is never requested so `ready` status is always "false".

STEPS TO REPRODUCE
1. Create simply applet with :
```
import QtQuick 2.9
import org.kde.ksysguard.sensors 1.0 as Sensors

Item {
  Timer {
    interval: 1000
    running: true
    onTriggered: sensorsModel.enabled = true
  }

  Sensors.SensorDataModel {
    id: sensorsModel
    enabled: false
    sensors: ["cpu/all/usage"]
    onDataChanged: (index) => console.log(index, data(index))
  }
}
```
2. See the null index and error in log.

OBSERVED RESULT

- `ready` is never true
- `data` is never updated

EXPECTED RESULT

Work as intended.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: 5.27.4
(available in About System)
KDE Plasma Version: 5.27.4
KDE Frameworks Version:  5.104.0
Qt Version: 5.15.8

ADDITIONAL INFORMATION

Currently the only solution i have found is to re assign sensors when i enable "SensorDataModel". I done this with that code :
```
const sensors = sensorsModel.sensors;
sensorsModel.sensors = [];
sensorsModel.sensors = sensors;
```
Comment 1 Christoph Cullmann 2024-09-23 21:00:14 UTC
ksysguard is no longer maintained, in Plasma 6 there is the Plasma system monitor for this task.

If your issue still happens with the Plasma 6 replacement, please re-open and we can move this bug to the new product, thanks!