From e095d41f0bde88194b91142fe60c4c2fbd5be173 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 14 Jun 2022 15:57:28 +0200 Subject: [PATCH] Implement pulse animation option for ComboBox widget You can now call pulse() on it and it'll pulse in the warning colour. Contributes to issue CURA-8849. --- resources/qml/Widgets/ComboBox.qml | 31 ++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/resources/qml/Widgets/ComboBox.qml b/resources/qml/Widgets/ComboBox.qml index 0e98cdb25a..77e6c489e9 100644 --- a/resources/qml/Widgets/ComboBox.qml +++ b/resources/qml/Widgets/ComboBox.qml @@ -54,7 +54,34 @@ ComboBox } ] - background: UM.UnderlineBackground{} + background: UM.UnderlineBackground + { + //Rectangle for highlighting when this combobox needs to pulse. + Rectangle + { + anchors.fill: parent + opacity: 0 + color: UM.Theme.getColor("warning") + + SequentialAnimation on opacity + { + id: pulseAnimation + running: false + loops: 1 + alwaysRunToEnd: true + PropertyAnimation + { + to: 1 + duration: 300 + } + PropertyAnimation + { + to: 0 + duration : 2000 + } + } + } + } indicator: UM.ColorImage { @@ -167,6 +194,6 @@ ComboBox function pulse() { - //TODO: Initiate a pulse of colour. + pulseAnimation.restart(); } }