From 0b8e72710c26aef649585ad95d88232399304589 Mon Sep 17 00:00:00 2001 From: Julien Wadel Date: Thu, 7 Jul 2022 15:28:51 +0200 Subject: [PATCH] Upgrade binding loop workaround to real solution. --- .../ui/modules/Common/Form/Fields/TextAreaField.qml | 2 +- .../ui/modules/Common/Misc/ForceScrollBar.qml | 12 ++++-------- .../ui/modules/Linphone/Chat/ChatReplyMessage.qml | 9 ++------- 3 files changed, 7 insertions(+), 16 deletions(-) diff --git a/linphone-app/ui/modules/Common/Form/Fields/TextAreaField.qml b/linphone-app/ui/modules/Common/Form/Fields/TextAreaField.qml index 285e0c6b8..07ff17cbb 100644 --- a/linphone-app/ui/modules/Common/Form/Fields/TextAreaField.qml +++ b/linphone-app/ui/modules/Common/Form/Fields/TextAreaField.qml @@ -55,7 +55,7 @@ Rectangle { ScrollBar.vertical: ForceScrollBar { id: scrollBar - //policy: flickable.contentHeight > height ? ScrollBar.AlwaysOn : ScrollBar.AlwaysOff // Do not use because of binding loop issues + contentSizeTarget: flickable.contentHeight sizeTarget: flickable.height Component.onCompleted: updatePolicy() diff --git a/linphone-app/ui/modules/Common/Misc/ForceScrollBar.qml b/linphone-app/ui/modules/Common/Misc/ForceScrollBar.qml index c6ccfa812..4eb290338 100644 --- a/linphone-app/ui/modules/Common/Misc/ForceScrollBar.qml +++ b/linphone-app/ui/modules/Common/Misc/ForceScrollBar.qml @@ -12,22 +12,18 @@ ScrollBar { property int contentSizeTarget property int sizeTarget - onContentSizeTargetChanged: delayUpdatePolicy.restart() - onSizeTargetChanged: delayUpdatePolicy.restart() + onContentSizeTargetChanged: Qt.callLater( scrollBar.updatePolicy) + onSizeTargetChanged: Qt.callLater( scrollBar.updatePolicy) policy: ScrollBar.AlwaysOff function updatePolicy(){ policy = contentSizeTarget > sizeTarget ? ScrollBar.AlwaysOn : ScrollBar.AlwaysOff } function delayPolicy(){ - delayUpdatePolicy.restart() + Qt.callLater( scrollBar.updatePolicy) } Component.onCompleted: updatePolicy() - Timer{// Delay to avoid binding loops - id:delayUpdatePolicy - interval:10 - onTriggered: scrollBar.updatePolicy() - } + background: Rectangle { anchors.fill: parent diff --git a/linphone-app/ui/modules/Linphone/Chat/ChatReplyMessage.qml b/linphone-app/ui/modules/Linphone/Chat/ChatReplyMessage.qml index 847d67805..6550b4787 100644 --- a/linphone-app/ui/modules/Linphone/Chat/ChatReplyMessage.qml +++ b/linphone-app/ui/modules/Linphone/Chat/ChatReplyMessage.qml @@ -133,13 +133,8 @@ Item { model: ContentProxyModel{ chatMessageModel: mainItem.chatMessageModel } - Timer{// Delay to avoid binding loops - id:delayUpdate - interval:10 - onTriggered: replyMessage.height = replyMessage.contentHeight - } - onContentHeightChanged: delayUpdate.restart() - //height: contentHeight + + onContentHeightChanged: Qt.callLater( function(){replyMessage.height = replyMessage.contentHeight}) delegate: ChatContent{ contentModel: $modelData