From eebe215a62729176353ea8bab717a9d0d739afe4 Mon Sep 17 00:00:00 2001 From: miruka Date: Wed, 2 Sep 2020 11:53:44 -0400 Subject: [PATCH] Fix image viewer size 0x0 while loading & for GIFs --- src/gui/Base/HImage.qml | 6 ++++++ src/gui/Popups/ImageViewerPopup/ViewerInfo.qml | 14 +++++++++++--- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/gui/Base/HImage.qml b/src/gui/Base/HImage.qml index 48413a5f..65c3c27b 100644 --- a/src/gui/Base/HImage.qml +++ b/src/gui/Base/HImage.qml @@ -30,6 +30,12 @@ Image { readonly property int animatedPaintedHeight: animatedLoader.item ? animatedLoader.item.paintedHeight : 0 + readonly property int animatedImplicitWidth: + animatedLoader.item ? animatedLoader.item.implicitWidth : 0 + + readonly property int animatedImplicitHeight: + animatedLoader.item ? animatedLoader.item.implicitHeight : 0 + function reload() { // Can be reimplemented in components inheriting HImage const oldSource = source diff --git a/src/gui/Popups/ImageViewerPopup/ViewerInfo.qml b/src/gui/Popups/ImageViewerPopup/ViewerInfo.qml index 7823cede..0a9b9be7 100644 --- a/src/gui/Popups/ImageViewerPopup/ViewerInfo.qml +++ b/src/gui/Popups/ImageViewerPopup/ViewerInfo.qml @@ -46,9 +46,17 @@ Rectangle { HLabel { id: dimensions - text: qsTr("%1 x %2") - .arg(viewer.canvas.full.implicitWidth) - .arg(viewer.canvas.full.implicitHeight) + text: + qsTr("%1 x %2") + .arg( + viewer.canvas.full.animatedImplicitWidth || + viewer.canvas.full.implicitWidth || + viewer.overallSize.width + ).arg( + viewer.canvas.full.animatedImplicitHeight || + viewer.canvas.full.implicitHeight || + viewer.overallSize.height + ) elide: HLabel.ElideRight topPadding: theme.spacing / 2