From 19084358c7c4e29fc7a99183ca0af1b947664a72 Mon Sep 17 00:00:00 2001 From: Fushan Wen Date: Sat, 28 May 2022 10:44:25 +0800 Subject: [PATCH] wallpapers/image: use the aspect ratio of the screen it will change the wallpaper for Th aspect ratio of thumbnails should follow the Plasmoid size, not the screen size. BUG: 452308 FIXED-IN: 5.25 --- .../contents/ui/ThumbnailsComponent.qml | 23 +++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/wallpapers/image/imagepackage/contents/ui/ThumbnailsComponent.qml b/wallpapers/image/imagepackage/contents/ui/ThumbnailsComponent.qml index 6f61d9352..6aa5fcef8 100644 --- a/wallpapers/image/imagepackage/contents/ui/ThumbnailsComponent.qml +++ b/wallpapers/image/imagepackage/contents/ui/ThumbnailsComponent.qml @@ -11,6 +11,7 @@ import QtQuick.Window 2.15 // for Screen import org.kde.kcm 1.5 as KCM import org.kde.kirigami 2.12 as Kirigami +import org.kde.plasma.plasmoid 2.0 Item { id: thumbnailsComponent @@ -36,8 +37,26 @@ Item { } //set the size of the cell, depending on Screen resolution to respect the aspect ratio - view.implicitCellWidth: Screen.width / 10 + Kirigami.Units.smallSpacing * 2 - view.implicitCellHeight: Screen.height / 10 + Kirigami.Units.smallSpacing * 2 + Kirigami.Units.gridUnit * 3 + view.implicitCellWidth: { + let screenWidth = 0; + if (typeof Plasmoid !== "undefined") { + screenWidth = Plasmoid.width; + } else { + screenWidth = Screen.width; + } + + return screenWidth / 10 + Kirigami.Units.smallSpacing * 2 + } + view.implicitCellHeight: { + let screenHeight = 0; + if (typeof Plasmoid !== "undefined") { + screenHeight = Plasmoid.height; + } else { + screenHeight = Screen.height; + } + + return screenHeight / 10 + Kirigami.Units.smallSpacing * 2 + Kirigami.Units.gridUnit * 3 + } view.reuseItems: true