From 45944d280d08c883c030d9b38ac4bf79eb112ecc Mon Sep 17 00:00:00 2001 From: Sander van Grieken Date: Thu, 11 May 2023 13:59:41 +0200 Subject: [PATCH] qml: update channelbar when conditions change --- .../qml/components/controls/ChannelBar.qml | 27 ++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/electrum/gui/qml/components/controls/ChannelBar.qml b/electrum/gui/qml/components/controls/ChannelBar.qml index 0a3d3ee73..606a25934 100644 --- a/electrum/gui/qml/components/controls/ChannelBar.qml +++ b/electrum/gui/qml/components/controls/ChannelBar.qml @@ -17,7 +17,7 @@ Item { height: 10 implicitWidth: 100 - onWidthChanged: { + function update() { var cap = capacity.satsInt * 1000 var twocap = cap * 2 l1.width = width * (cap - localCapacity.msatsInt) / twocap @@ -37,6 +37,31 @@ Item { } r1.width = width * (cap - remoteCapacity.msatsInt) / twocap } + + onWidthChanged: update() + onFrozenForSendingChanged: update() + onFrozenForReceivingChanged: update() + + Connections { + target: localCapacity + function onMsatsIntChanged() { update() } + } + + Connections { + target: remoteCapacity + function onMsatsIntChanged() { update() } + } + + Connections { + target: canSend + function onMsatsIntChanged() { update() } + } + + Connections { + target: canReceive + function onMsatsIntChanged() { update() } + } + Rectangle { id: l1 x: 0