DesktopWidgets: simplified UI

This commit is contained in:
Lemmy
2025-12-14 14:02:53 -05:00
parent aaeed7e4d7
commit 72c9be102c
15 changed files with 60 additions and 139 deletions
+3 -1
View File
@@ -31,6 +31,8 @@ RowLayout {
property string searchText: ""
function findIndexByKey(key) {
if (!root.model)
return -1;
for (var i = 0; i < root.model.count; i++) {
if (root.model.get(i).key === key) {
return i;
@@ -154,7 +156,7 @@ RowLayout {
// Look up current selection directly in source model by key
readonly property int sourceIndex: root.findIndexByKey(root.currentKey)
readonly property bool hasSelection: sourceIndex >= 0 && sourceIndex < root.model.count
readonly property bool hasSelection: root.model && sourceIndex >= 0 && sourceIndex < root.model.count
color: hasSelection ? Color.mOnSurface : Color.mOnSurfaceVariant
text: hasSelection ? root.model.get(sourceIndex).name : root.placeholder