diff options
| author | littleblack111 <littleblack11111@gmail.com> | 2025-08-17 19:49:22 +0800 |
|---|---|---|
| committer | littleblack111 <littleblack11111@gmail.com> | 2025-08-19 20:15:21 +0800 |
| commit | a245f46bbf025490a8fab117481f65f78a8f3d70 (patch) | |
| tree | 268f013a31646a8b610b4497181aea942c1a0fa0 /launcher | |
| parent | ae750dbadf9139add77a172f4595077e8826e755 (diff) | |
fix(App, Clip): mouse scrolling
Diffstat (limited to 'launcher')
| -rw-r--r-- | launcher/components/App.qml | 11 | ||||
| -rw-r--r-- | launcher/components/Clip.qml | 14 |
2 files changed, 22 insertions, 3 deletions
diff --git a/launcher/components/App.qml b/launcher/components/App.qml index 3deb50b..5851d3c 100644 --- a/launcher/components/App.qml +++ b/launcher/components/App.qml @@ -12,6 +12,7 @@ IComponent { property list<DesktopEntry> entries: active ? AppSearch.query(inputCleaned) : [] property int selectedIndex: -1 + property bool mouseTriggered: false name: "Applications" @@ -44,23 +45,27 @@ IComponent { up: function () { if (selectedIndex <= 0) return true; + mouseTriggered = false; selectedIndex--; } down: function () { if (selectedIndex + 1 > listView.count - 1) return true; + mouseTriggered = false; selectedIndex++; } home: function () { if (listView.count === 0) return true; + mouseTriggered = false; selectedIndex = -1; selectedIndex = 0; } end: function () { if (listView.count === 0) return true; + mouseTriggered = false; selectedIndex = listView.count; selectedIndex = listView.count - 1; } @@ -68,6 +73,7 @@ IComponent { pgup: function () { if (listView.count === 0) return true; + mouseTriggered = false; const pageSize = Math.floor(listView.height / (General.appIconSize + Launcher.innerMargin * 2)); if (selectedIndex - pageSize < 0) { selectedIndex = 0; @@ -79,6 +85,7 @@ IComponent { pgdn: function () { if (listView.count === 0) return true; + mouseTriggered = false; const pageSize = Math.floor(listView.height / (General.appIconSize + Launcher.innerMargin * 2)); if (selectedIndex + pageSize >= listView.count) { selectedIndex = listView.count - 1; @@ -95,7 +102,7 @@ IComponent { onSelectedIndexChanged: { syncSelectionState(); - if (selectedIndex < 0 || selectedIndex >= listView.count) + if (selectedIndex < 0 || selectedIndex >= listView.count || mouseTriggered) return; Qt.callLater(() => { listView.positionViewAtIndex(selectedIndex, ListView.Contain); @@ -157,9 +164,11 @@ IComponent { anchors.fill: parent hoverEnabled: true onPositionChanged: { + root.mouseTriggered = true; root.selectedIndex = index; } onExited: { + root.mouseTriggered = true; root.selectedIndex = 0; } onPressed: { diff --git a/launcher/components/Clip.qml b/launcher/components/Clip.qml index a02fcbc..b9bd610 100644 --- a/launcher/components/Clip.qml +++ b/launcher/components/Clip.qml @@ -12,6 +12,7 @@ IComponent { property var clipHist: Clip.query(inputCleaned) property int selectedIndex: -1 + property bool mouseTriggered: false name: "Clipboard" @@ -34,23 +35,28 @@ IComponent { up: function () { if (selectedIndex <= 0) return true; + mouseTriggered = false; selectedIndex--; } down: function () { if (selectedIndex + 1 > listView.count - 1) return true; + mouseTriggered = false; selectedIndex++; } onClipHistChanged: { + mouseTriggered = false; selectedIndex = 0; listView.positionViewAtBeginning(); syncSelectionState(); } onSelectedIndexChanged: { - if (selectedIndex >= 0 && selectedIndex < listView.count) { - listView.positionViewAtIndex(selectedIndex, ListView.Contain); + if (!mouseTriggered && selectedIndex >= 0 && selectedIndex < listView.count) { + Qt.callLater(() => { + listView.positionViewAtIndex(selectedIndex, ListView.Contain); + }); } syncSelectionState(); } @@ -76,6 +82,7 @@ IComponent { RowLayout { Layout.fillWidth: true Layout.fillHeight: true + ListView { id: listView Layout.fillWidth: true @@ -140,9 +147,11 @@ IComponent { anchors.fill: parent hoverEnabled: true onPositionChanged: { + root.mouseTriggered = true; root.selectedIndex = index; } onExited: { + root.mouseTriggered = true; root.selectedIndex = 0; } onPressed: { @@ -151,6 +160,7 @@ IComponent { } } } + Flickable { id: preview clip: true |
