kcms/tabbox: Mock-up closeable role for previews

Fixes a qml warning and wrong representation when trying to
access this model property
This commit is contained in:
Ismael Asensio 2024-01-13 02:23:46 +01:00
parent 3572e6f0e7
commit 3353ed87ef
2 changed files with 5 additions and 1 deletions

View file

@ -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<int, QByteArray> ExampleClientModel::roleNames() const
{DesktopNameRole, QByteArrayLiteral("desktopName")},
{IconRole, QByteArrayLiteral("icon")},
{WindowIdRole, QByteArrayLiteral("windowId")},
{CloseableRole, QByteArrayLiteral("closeable")},
};
}

View file

@ -44,7 +44,8 @@ public:
MinimizedRole,
DesktopNameRole,
IconRole,
WindowIdRole
WindowIdRole,
CloseableRole,
};
explicit ExampleClientModel(QObject *parent = nullptr);