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/components/Clip.qml | |
| parent | ae750dbadf9139add77a172f4595077e8826e755 (diff) | |
fix(App, Clip): mouse scrolling
Diffstat (limited to 'launcher/components/Clip.qml')
| -rw-r--r-- | launcher/components/Clip.qml | 14 |
1 files changed, 12 insertions, 2 deletions
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 |
