From baf4b27e60c5442a6ce7fa44519c7f302ba8acb7 Mon Sep 17 00:00:00 2001 From: Sebastian Wolf Date: Thu, 19 Nov 2020 20:25:53 +0100 Subject: [PATCH] Avoid stale state for chat page picture --- qml/pages/ChatPage.qml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/qml/pages/ChatPage.qml b/qml/pages/ChatPage.qml index 1e85c51..42999ef 100644 --- a/qml/pages/ChatPage.qml +++ b/qml/pages/ChatPage.qml @@ -595,12 +595,21 @@ Page { ProfileThumbnail { id: chatPictureThumbnail - photoData: chatModel.smallPhoto replacementStringHint: chatNameText.text width: chatOverviewColumn.height height: chatOverviewColumn.height anchors.bottom: parent.bottom anchors.bottomMargin: chatPage.isPortrait ? Theme.paddingMedium : Theme.paddingSmall + + // Setting it directly may cause an stale state for the thumbnail in case the chat page + // was previously loaded with a picture and now it doesn't have one. Instead setting it + // when the ChatModel indicates a change. This also avoids flickering when the page is loaded... + Connections { + target: chatModel + onSmallPhotoChanged: { + chatPictureThumbnail.photoData = chatModel.smallPhoto; + } + } } Column {