Commit d5df9379 authored by David Redondo's avatar David Redondo 🏎
Browse files

Prevent showing wrong speeds on initial open

Previous attempt was the onCompleted block. However it turns out that
at that point the model still has the old byte amounts.  The order is
showSpeedChanged -> setRefreshRate -> Timer.onCompleted/runningChanged -> model updates
So set the amount to 0 in onCompleted and trigger the Timer on start
(like a Timer with 0 interval). This initial trigger happens after the
 odel gets a new value and we have a correct amount on the first regular
trigger of the Timer.
BUG:420365
FIXED-IN:5.22
parent f546b759
......@@ -209,11 +209,12 @@ PlasmaExtras.ExpandableListItem {
repeat: true
interval: 2000
running: showSpeed
triggeredOnStart: true
property real prevRxBytes
property real prevTxBytes
Component.onCompleted: {
prevRxBytes = RxBytes
prevTxBytes = TxBytes
prevRxBytes = 0
prevTxBytes = 0
}
onTriggered: {
rxBytes = prevRxBytes == 0 ? 0 : (RxBytes - prevRxBytes) * 1000 / interval
......
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