From 3353ed87ef04a220ef1b133ff47487cb808dc1b3 Mon Sep 17 00:00:00 2001 From: Ismael Asensio Date: Sat, 13 Jan 2024 02:23:46 +0100 Subject: [PATCH] kcms/tabbox: Mock-up closeable role for previews Fixes a qml warning and wrong representation when trying to access this model property --- src/kcms/tabbox/layoutpreview.cpp | 3 +++ src/kcms/tabbox/layoutpreview.h | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/kcms/tabbox/layoutpreview.cpp b/src/kcms/tabbox/layoutpreview.cpp index 2b84610d39..b975ad4dc4 100644 --- a/src/kcms/tabbox/layoutpreview.cpp +++ b/src/kcms/tabbox/layoutpreview.cpp @@ -159,6 +159,8 @@ QVariant ExampleClientModel::data(const QModelIndex &index, int role) const return item.icon; case WindowIdRole: return item.wId; + case CloseableRole: + return item.wId != WindowThumbnailItem::Desktop; } return QVariant(); } @@ -187,6 +189,7 @@ QHash ExampleClientModel::roleNames() const {DesktopNameRole, QByteArrayLiteral("desktopName")}, {IconRole, QByteArrayLiteral("icon")}, {WindowIdRole, QByteArrayLiteral("windowId")}, + {CloseableRole, QByteArrayLiteral("closeable")}, }; } diff --git a/src/kcms/tabbox/layoutpreview.h b/src/kcms/tabbox/layoutpreview.h index 57030faec3..4524d7c5fa 100644 --- a/src/kcms/tabbox/layoutpreview.h +++ b/src/kcms/tabbox/layoutpreview.h @@ -44,7 +44,8 @@ public: MinimizedRole, DesktopNameRole, IconRole, - WindowIdRole + WindowIdRole, + CloseableRole, }; explicit ExampleClientModel(QObject *parent = nullptr);