From 66d74f4398fbe5e7236532d5cdd8112400d66429 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Thu, 19 Aug 2021 11:06:51 +0300 Subject: [PATCH] effects/overview: Use Kirigami.ScenePosition This makes the WindowHeap more robust to layout changes. Currently, the main issue with it is that thumbnails will be misplaced if the heap's scene position changes. Kirigami.ScenePosition automagically keeps track of the item's scene pos. --- src/effects/overview/qml/WindowHeap.qml | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/effects/overview/qml/WindowHeap.qml b/src/effects/overview/qml/WindowHeap.qml index 835210ad43..e26a6c0a0d 100644 --- a/src/effects/overview/qml/WindowHeap.qml +++ b/src/effects/overview/qml/WindowHeap.qml @@ -5,6 +5,7 @@ */ import QtQuick 2.12 +import org.kde.kirigami 2.12 as Kirigami import org.kde.kwin 3.0 as KWinComponents import org.kde.kwin.private.overview 1.0 import org.kde.plasma.components 3.0 as PC3 @@ -31,9 +32,6 @@ FocusScope { focus: true spacing: PlasmaCore.Units.largeSpacing - // This assumes that the position of the WindowHeap is static. - readonly property point scenePosition: mapToItem(null, 0, 0) - Repeater { id: windowsRepeater @@ -62,8 +60,8 @@ FocusScope { ExpoCell { id: cell layout: expoLayout - naturalX: thumb.client.x - targetScreen.geometry.x - expoLayout.scenePosition.x - naturalY: thumb.client.y - targetScreen.geometry.y - expoLayout.scenePosition.y + naturalX: thumb.client.x - targetScreen.geometry.x - expoLayout.Kirigami.ScenePosition.x + naturalY: thumb.client.y - targetScreen.geometry.y - expoLayout.Kirigami.ScenePosition.y naturalWidth: thumb.client.width naturalHeight: thumb.client.height persistentKey: thumb.client.internalId @@ -74,8 +72,8 @@ FocusScope { name: "initial" PropertyChanges { target: thumb - x: thumb.client.x - targetScreen.geometry.x - expoLayout.scenePosition.x - y: thumb.client.y - targetScreen.geometry.y - expoLayout.scenePosition.y + x: thumb.client.x - targetScreen.geometry.x - expoLayout.Kirigami.ScenePosition.x + y: thumb.client.y - targetScreen.geometry.y - expoLayout.Kirigami.ScenePosition.y width: thumb.client.width height: thumb.client.height }