diff --git a/src/timeline/ImageComponent.qml b/src/timeline/ImageComponent.qml index 288dc2224..7cd489a9c 100644 --- a/src/timeline/ImageComponent.qml +++ b/src/timeline/ImageComponent.qml @@ -46,6 +46,11 @@ Item { */ required property var fileTransferInfo + /** + * The maximum height of the image. Can be left undefined most of the times. Passed to MediaSizeHelper::contentMaxHeight. + */ + property int contentMaxHeight: undefined + implicitWidth: mediaSizeHelper.currentSize.width implicitHeight: mediaSizeHelper.currentSize.height @@ -164,6 +169,7 @@ Item { MediaSizeHelper { id: mediaSizeHelper contentMaxWidth: root.Message.maxContentWidth + contentMaxHeight: root.contentMaxHeight mediaWidth: root?.mediaInfo.isSticker ? 256 : (root?.mediaInfo.width ?? 0) mediaHeight: root?.mediaInfo.isSticker ? 256 : (root?.mediaInfo.height ?? 0) } diff --git a/src/timeline/ReplyMessageComponentChooser.qml b/src/timeline/ReplyMessageComponentChooser.qml index 81c732615..be1020419 100644 --- a/src/timeline/ReplyMessageComponentChooser.qml +++ b/src/timeline/ReplyMessageComponentChooser.qml @@ -41,22 +41,8 @@ DelegateChooser { DelegateChoice { roleValue: MessageComponentType.Image - delegate: Image { - id: image - - required property var mediaInfo - - Layout.maximumWidth: mediaSizeHelper.currentSize.width - Layout.maximumHeight: mediaSizeHelper.currentSize.height - source: image.mediaInfo.source - - MediaSizeHelper { - id: mediaSizeHelper - contentMaxWidth: Message.maxContentWidth - contentMaxHeight: Kirigami.Units.gridUnit * 5 - mediaWidth: image.mediaInfo.width ?? 0 - mediaHeight: image.mediaInfo.height ?? 0 - } + delegate: ImageComponent { + contentMaxHeight: Kirigami.Units.gridUnit * 5 } }