From 09c442f244f9d31af36004ec4be21b7062167cb2 Mon Sep 17 00:00:00 2001 From: littleblack111 Date: Sun, 23 Aug 2026 14:08:42 +0800 Subject: fix(Clip): stop it stealing selected after something else already changed it --- popups/launcher/Launcher.qml | 1 - popups/launcher/components/App.qml | 7 ++++--- popups/launcher/components/Clip.qml | 12 ++++++------ popups/launcher/components/Emoji.qml | 7 +++++++ popups/launcher/components/Spell.qml | 6 ++++-- 5 files changed, 21 insertions(+), 12 deletions(-) diff --git a/popups/launcher/Launcher.qml b/popups/launcher/Launcher.qml index 2b3f40f..1e1eb89 100644 --- a/popups/launcher/Launcher.qml +++ b/popups/launcher/Launcher.qml @@ -424,7 +424,6 @@ ILauncher { } if (set !== 0) { - // launcher.state.priorities[launcher.state.selectedPriority].syncSelectionState(); switch (set) { case 1: if (launcher.state.selectedPriority < launcher.state.priorities.length - 1) { diff --git a/popups/launcher/components/App.qml b/popups/launcher/components/App.qml index a4c0d2c..f3ce41d 100644 --- a/popups/launcher/components/App.qml +++ b/popups/launcher/components/App.qml @@ -94,7 +94,6 @@ IComponent { } selectedIndex = 0; - listView.contentY = 0; syncSelectionState(); } @@ -109,8 +108,10 @@ IComponent { syncSelectionState: function () { Qt.callLater(() => { - if (!isSelectedPriority() && state.selected === listView.itemAtIndex(selectedIndex)) { - state.selected = null; + if (!isSelectedPriority()) { + if (state.selected === listView.itemAtIndex(selectedIndex)) + state.selected = null; + return; } diff --git a/popups/launcher/components/Clip.qml b/popups/launcher/components/Clip.qml index 39712ef..38df084 100644 --- a/popups/launcher/components/Clip.qml +++ b/popups/launcher/components/Clip.qml @@ -44,7 +44,6 @@ IComponent { home: function () { if (selectedIndex <= 0) return true; - selectedIndex = -1; selectedIndex = 0; } end: function () { @@ -60,23 +59,24 @@ IComponent { } selectedIndex = 0; - listView.positionViewAtBeginning(); syncSelectionState(); } onSelectedIndexChanged: { if (selectedIndex >= 0 && selectedIndex < listView.count) Qt.callLater(() => { + listView.positionViewAtIndex(selectedIndex, ListView.Visible); + syncSelectionState(); listView.positionViewAtIndex(selectedIndex, ListView.Contain); }); - - syncSelectionState(); } syncSelectionState: function () { Qt.callLater(() => { - if (!isSelectedPriority() && state.selected === listView.itemAtIndex(selectedIndex)) { - state.selected = null; + if (!isSelectedPriority()) { + if (state.selected && state.selected === listView.itemAtIndex(selectedIndex)) + state.selected = null; + return; } diff --git a/popups/launcher/components/Emoji.qml b/popups/launcher/components/Emoji.qml index f45ada0..5dc9cd6 100644 --- a/popups/launcher/components/Emoji.qml +++ b/popups/launcher/components/Emoji.qml @@ -97,6 +97,13 @@ IComponent { syncSelectionState: function () { Qt.callLater(() => { + if (!isSelectedPriority()) { + if (state.selected === listView.itemAtIndex(selectedIndex)) + state.selected = null; + + return; + } + if (!loader.view || selectedIndex < 0 || selectedIndex >= loader.view.count || !root.visible) return; diff --git a/popups/launcher/components/Spell.qml b/popups/launcher/components/Spell.qml index 5e5d20a..1f8a15c 100644 --- a/popups/launcher/components/Spell.qml +++ b/popups/launcher/components/Spell.qml @@ -115,8 +115,10 @@ IComponent { syncSelectionState: function () { Qt.callLater(() => { - if (!isSelectedPriority() && state.selected === loader.view.itemAtIndex(selectedIndex)) { - state.selected = null; + if (!isSelectedPriority()) { + if (state.selected === listView.itemAtIndex(selectedIndex)) + state.selected = null; + return; } -- cgit v1.2.3