mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-11-02 20:52:20 -07:00
Make canvas use a one-time Timer to update
CURA-4182 The canvas approach has a drawback on the UI update: when a printcore or a material is changed, calling requestPaint() to the canvas doesn't trigger an immediate update. The solution is to have a built-in Timer in the Canvas and to use that to update. Somehow this just works. The problem with this approach is that the Timer constantly updates the canvas which eats a lot of CPU power. To solve this, I changed the timer to be a one-time timer and it will be started when there is a material/print core update.
This commit is contained in:
parent
241a7a4fb2
commit
1e5b032cff
1 changed files with 5 additions and 3 deletions
|
|
@ -143,6 +143,7 @@ Item
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
resolutionSlider.currentQualityIndex = undefined;
|
resolutionSlider.currentQualityIndex = undefined;
|
||||||
|
backgroundBarUpdateTimer.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateBar()
|
function updateBar()
|
||||||
|
|
@ -246,9 +247,10 @@ Item
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
||||||
Timer {
|
Timer {
|
||||||
interval: 16
|
id: backgroundBarUpdateTimer
|
||||||
running: true
|
interval: 10
|
||||||
repeat: true
|
running: false
|
||||||
|
repeat: false
|
||||||
onTriggered: backgroundBar.requestPaint()
|
onTriggered: backgroundBar.requestPaint()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue