From b7ea6f265eadc8dc6d5d983bab23f9cdef48b75d Mon Sep 17 00:00:00 2001 From: Joshua Goins Date: Fri, 20 Feb 2026 16:02:49 -0500 Subject: [PATCH] Fix-up ImageComponent's hide media functionality The Z-level for the "Hide media" and other overlay controls were lost during the rich text refactor, and now restored. I also made it so the blurhash is now used when the media is hidden, and when hiding media it no longer allows you to jumpscare yourself by maximizing the media when you probably didn't actually want to. When the media doesn't have blurhash, it falls back to black. --- src/messagecontent/ImageComponent.qml | 55 +++++++++++++-------------- 1 file changed, 27 insertions(+), 28 deletions(-) diff --git a/src/messagecontent/ImageComponent.qml b/src/messagecontent/ImageComponent.qml index f0b83941d..32eb178ed 100644 --- a/src/messagecontent/ImageComponent.qml +++ b/src/messagecontent/ImageComponent.qml @@ -66,8 +66,9 @@ Item { anchors.right: root.right anchors.rightMargin: root.rightAnchorMargin + Kirigami.Units.smallSpacing - QQC2.Button { + z: 10 + QQC2.Button { visible: !_private.hideImage && !root.editable icon.name: "view-hidden" text: i18nc("@action:button", "Hide Image") @@ -119,6 +120,30 @@ Item { } } + Rectangle { + anchors.fill: parent + + visible: (_private.imageItem?.status !== Image.Ready ?? true) || _private.hideImage + + color: "#BB000000" + + QQC2.ProgressBar { + anchors.centerIn: parent + + width: parent.width * 0.8 + visible: !_private.hideImage + + from: 0 + to: 1.0 + value: _private.imageItem?.progress ?? 0.0 + } + + Image { + anchors.fill: parent + source: root?.componentAttributes.tempInfo?.source ?? "" + } + } + Loader { id: imageLoader @@ -151,12 +176,6 @@ Item { } } - Image { - anchors.fill: parent - source: visible ? (root?.componentAttributes.tempInfo?.source ?? "") : "" - visible: _private.imageItem && _private.imageItem.status !== Image.Ready && !_private.hideImage - } - QQC2.ToolTip.text: root.display QQC2.ToolTip.visible: hoverHandler.hovered QQC2.ToolTip.delay: Kirigami.Units.toolTipDelay @@ -165,26 +184,6 @@ Item { id: hoverHandler } - Rectangle { - anchors.fill: parent - - visible: _private.imageItem.status !== Image.Ready || _private.hideImage - - color: "#BB000000" - - QQC2.ProgressBar { - anchors.centerIn: parent - - width: parent.width * 0.8 - visible: !_private.hideImage - - from: 0 - to: 1.0 - value: _private.imageItem.progress - } - - } - QQC2.Button { anchors.centerIn: parent text: i18nc("@action:button", "Show Image") @@ -206,7 +205,7 @@ Item { if (root.Message.timeline) { root.Message.timeline.interactive = false; } - if (!root.componentAttributes.isSticker && !root.editable) { + if (!root.componentAttributes.isSticker && !root.editable && !_private.hideImage) { RoomManager.maximizeMedia(root.eventId); } }