diff options
| author | littleblack111 <littleblack11111@gmail.com> | 2026-09-02 00:06:59 +0800 |
|---|---|---|
| committer | littleblack111 <littleblack11111@gmail.com> | 2026-09-02 00:06:59 +0800 |
| commit | bd3328e134ba6654458d1de70af9f79f86009318 (patch) | |
| tree | c70ce7a733ddc5241119d742102a42bfd4e22884 | |
| parent | d7e899d575b60eb66948c6a4f483e405b1bfb97a (diff) | |
IComponent: overwrite last selected instead of manual leave
| -rw-r--r-- | popups/launcher/components/App.qml | 9 | ||||
| -rw-r--r-- | popups/launcher/components/Clip.qml | 9 | ||||
| -rw-r--r-- | popups/launcher/components/Emoji.qml | 8 | ||||
| -rw-r--r-- | popups/launcher/components/IComponent.qml | 12 | ||||
| -rw-r--r-- | popups/launcher/components/SelectionState.qml | 5 | ||||
| -rw-r--r-- | popups/launcher/components/Spell.qml | 7 |
6 files changed, 15 insertions, 35 deletions
diff --git a/popups/launcher/components/App.qml b/popups/launcher/components/App.qml index 492b459..aa278f1 100644 --- a/popups/launcher/components/App.qml +++ b/popups/launcher/components/App.qml @@ -79,6 +79,7 @@ IComponent { pgdn: function () { if (selectedIndex === entries.length - 1) return true; + const pageSize = Math.floor(listView.height / (General.appIconSize + Launcher.innerMargin * 2)); if (selectedIndex + pageSize >= listView.count) { selectedIndex = listView.count - 1; @@ -111,17 +112,9 @@ IComponent { syncSelectionState: function () { Qt.callLater(() => { - if (!isSelectedPriority()) { - if (state.selected === listView.itemAtIndex(selectedIndex)) - state.selected = null; - - return; - } - if (selectedIndex < 0 || selectedIndex >= listView.count || !root.visible) return; - trySetSelfPriority(); state.selected = listView.itemAtIndex(selectedIndex); }); } diff --git a/popups/launcher/components/Clip.qml b/popups/launcher/components/Clip.qml index ab2721f..9b7a0a9 100644 --- a/popups/launcher/components/Clip.qml +++ b/popups/launcher/components/Clip.qml @@ -51,6 +51,7 @@ IComponent { return true; selectedIndex = listView.count - 1; } + // TODO: impl pgup pgdn onClipHistChanged: { if (selectedIndex !== -1) { @@ -73,14 +74,6 @@ IComponent { syncSelectionState: function () { Qt.callLater(() => { - if (!isSelectedPriority()) { - // TODO: fix sometimes - if (state.selected && state.selected === listView.itemAtIndex(selectedIndex)) - state.selected = null; - - return; - } - if (!root.visible || selectedIndex < 0 || selectedIndex >= listView.count) return; diff --git a/popups/launcher/components/Emoji.qml b/popups/launcher/components/Emoji.qml index fc842ef..ecb1cd4 100644 --- a/popups/launcher/components/Emoji.qml +++ b/popups/launcher/components/Emoji.qml @@ -97,17 +97,9 @@ IComponent { syncSelectionState: function () { Qt.callLater(() => { - if (!isSelectedPriority()) { - if (state.selected === loader.view.itemAtIndex(selectedIndex)) - state.selected = null; - - return; - } - if (!loader.view || selectedIndex < 0 || selectedIndex >= loader.view.count || !root.visible) return; - trySetSelfPriority(); state.selected = loader.view.itemAtIndex(selectedIndex); }); } diff --git a/popups/launcher/components/IComponent.qml b/popups/launcher/components/IComponent.qml index 90c3ab8..e48a0a1 100644 --- a/popups/launcher/components/IComponent.qml +++ b/popups/launcher/components/IComponent.qml @@ -65,6 +65,12 @@ IRect { bottom: true }) + function enter() { + trySetSelfPriority(); + // root or null hmm + state.selected = root; + } + signal close function _exec() { @@ -124,10 +130,10 @@ IRect { HoverHandler { onHoveredChanged: { - if (hovered) - root.trySetSelfPriority(); - else + if (hovered) { + root.enter(); root.syncSelectionState(); + } } } diff --git a/popups/launcher/components/SelectionState.qml b/popups/launcher/components/SelectionState.qml index c133af8..5b80b2e 100644 --- a/popups/launcher/components/SelectionState.qml +++ b/popups/launcher/components/SelectionState.qml @@ -25,6 +25,7 @@ Singleton { signal syncSelectionState onSelectedPriorityChanged: { + priorities[selectedPriority]?.enter(); priorities[selectedPriority]?.syncSelectionState(); } @@ -40,8 +41,10 @@ Singleton { if (!priorities[selectedPriority] && selectedPriority > 0) { selectedPriority--; Qt.callLater(step); - } else + } else { + priorities[selectedPriority]?.enter(); priorities[selectedPriority]?.syncSelectionState(); + } }); } } diff --git a/popups/launcher/components/Spell.qml b/popups/launcher/components/Spell.qml index e5d2568..c09a705 100644 --- a/popups/launcher/components/Spell.qml +++ b/popups/launcher/components/Spell.qml @@ -115,13 +115,6 @@ IComponent { syncSelectionState: function () { Qt.callLater(() => { - if (!isSelectedPriority()) { - if (state.selected === loader.view.itemAtIndex(selectedIndex)) - state.selected = null; - - return; - } - if (!loader.view || selectedIndex < 0 || selectedIndex >= loader.view.count || !root.visible) return; |
