From aa23589f051c49072e2ad8135c884357c9601657 Mon Sep 17 00:00:00 2001 From: Tranter Madi Date: Sun, 30 Jan 2022 10:45:38 +0700 Subject: [PATCH] [applet/clipboard] Avoid too tall image --- .../contents/ui/ImageItemDelegate.qml | 23 ++++++++++++++----- 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/applets/clipboard/contents/ui/ImageItemDelegate.qml b/applets/clipboard/contents/ui/ImageItemDelegate.qml index 92b818669..dc7e6a9ae 100644 --- a/applets/clipboard/contents/ui/ImageItemDelegate.qml +++ b/applets/clipboard/contents/ui/ImageItemDelegate.qml @@ -10,10 +10,21 @@ import QtQuick 2.0 import org.kde.kquickcontrolsaddons 2.0 as KQuickControlsAddons import org.kde.plasma.core 2.0 as PlasmaCore -KQuickControlsAddons.QPixmapItem { - id: previewPixmap - width: Math.min(nativeWidth, width) - height: Math.min(nativeHeight, Math.round(width * (nativeHeight/nativeWidth) + PlasmaCore.Units.smallSpacing * 2)) - pixmap: DecorationRole - fillMode: KQuickControlsAddons.QPixmapItem.PreserveAspectFit +Item { + height: childrenRect.height + + KQuickControlsAddons.QPixmapItem { + id: previewPixmap + + width: Math.min(Math.round(height * nativeWidth/nativeHeight), parent.width) + height: Math.min(nativeHeight, PlasmaCore.Units.gridUnit * 4 + PlasmaCore.Units.smallSpacing * 2) + + // align left + // right in RTL + anchors.left: parent.left + + pixmap: DecorationRole + smooth: true + fillMode: KQuickControlsAddons.QPixmapItem.PreserveAspectFit + } }