Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion src/core/qml/DockPreview.qml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd.
// SPDX-FileCopyrightText: 2024-2026 UnionTech Software Technology Co., Ltd.
// SPDX-License-Identifier: Apache-2.0 OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only

import QtQuick
Expand Down Expand Up @@ -76,6 +76,18 @@ Item {
}
}

function removeSurface(surfaceWrapper) {
if (!surfaceWrapper)
return;

var index = desiredSurfaces.indexOf(surfaceWrapper);
if (index < 0)
return;

desiredSurfaces.splice(index, 1);
updateModel();
}

function activateWindow(surfaceWrapper) {
console.debug(qLcDockPreview, "activate preview window: ", surfaceWrapper)
Helper.forceActivateSurface(surfaceWrapper)
Expand Down Expand Up @@ -471,6 +483,13 @@ Item {
implicitHeight: root.isHorizontal ? 120 : Math.max(80, Math.min(120, 240 * wrapper.height / wrapper.width))
implicitWidth: root.isHorizontal ? Math.max(80, Math.min(240, 120 * wrapper.width / wrapper.height)) : 240

Connections {
target: wrapper
function onAboutToBeInvalidated() {
listview.model.removeSurface(wrapper)
}
}

ListView.onRemove: {
if (filterSurfaceModel.count) {
isRemoving = true
Expand Down
Loading