e008166d by 柴进

fix(qml): 右键菜单不弹 + 滚动条看不见 + 参考图无双击预览

3 个用户报告 bug:

1. 提示词输入框右键不弹菜单(TextArea/TextField)
   原因:QML TextArea 内嵌 TextEdit 先 grab 鼠标,TapHandler 收不到右键
   修:换 MouseArea + acceptedButtons:Qt.RightButton,左键自动透传

2. 历史 / sidebar ListView ScrollBar 默认 ~6px 太细看不见
   修:自定义 contentItem,8px 常驻 + hover/press 加深

3. 参考图缩略图不能双击预览(与生成图 / 历史大图不一致)
   修:加 TapHandler.onDoubleTapped → Qt.openUrlExternally
   与 DragHandler 共存:单 / 双击不会让 drag active,> 8px 才进入拖拽
1 parent be1128f6
...@@ -157,13 +157,27 @@ Item { ...@@ -157,13 +157,27 @@ Item {
157 id: historyList 157 id: historyList
158 Layout.fillWidth: true 158 Layout.fillWidth: true
159 Layout.fillHeight: true 159 Layout.fillHeight: true
160 Layout.rightMargin: 4 // 给 ScrollBar 留视觉空间
160 visible: count > 0 161 visible: count > 0
161 spacing: 4 162 spacing: 4
162 clip: true 163 clip: true
163 model: history.model 164 model: history.model
164 165
165 ScrollBar.vertical: ScrollBar { 166 ScrollBar.vertical: ScrollBar {
166 policy: ScrollBar.AsNeeded 167 id: historyScrollBar
168 policy: ScrollBar.AlwaysOn
169 // 默认 Basic 主题滚动条太细 — 自定义 contentItem,
170 // 8px 常驻 + hover/press 加深,扫一眼就看见。
171 contentItem: Rectangle {
172 implicitWidth: 8
173 radius: 4
174 color: historyScrollBar.pressed
175 ? App.Theme.borderStrong
176 : (historyScrollBar.hovered
177 ? App.Theme.borderDefault
178 : Qt.rgba(0, 0, 0, 0.18))
179 Behavior on color { ColorAnimation { duration: 100 } }
180 }
167 } 181 }
168 182
169 delegate: Rectangle { 183 delegate: Rectangle {
......
...@@ -412,6 +412,14 @@ Item { ...@@ -412,6 +412,14 @@ Item {
412 id: hoverHandler 412 id: hoverHandler
413 cursorShape: dragHandler.active ? Qt.ClosedHandCursor : Qt.OpenHandCursor 413 cursorShape: dragHandler.active ? Qt.ClosedHandCursor : Qt.OpenHandCursor
414 } 414 }
415 // 双击系统查看器打开(与历史 / 预览一致)。
416 // TapHandler 与 DragHandler 在 Qt Pointer Handler 框架里和平共存:
417 // 单 / 双击 release 时 dragHandler.active==false,触发 onDoubleTapped;
418 // 一旦超 8px 阈值进入 drag,TapHandler 自动放弃。
419 TapHandler {
420 acceptedButtons: Qt.LeftButton
421 onDoubleTapped: Qt.openUrlExternally("file:///" + modelData)
422 }
415 DragHandler { 423 DragHandler {
416 id: dragHandler 424 id: dragHandler
417 target: null // 自己不移动 delegate;ghost 单独绘制 425 target: null // 自己不移动 delegate;ghost 单独绘制
...@@ -660,10 +668,14 @@ Item { ...@@ -660,10 +668,14 @@ Item {
660 } 668 }
661 } 669 }
662 670
663 TapHandler { 671 // TapHandler 在 TextArea 内部不可靠(内嵌 TextEdit 先 grab 鼠标),
672 // 改用 MouseArea + acceptedButtons:Qt.RightButton —
673 // 未列出的 LeftButton 自动透传给 TextEdit,不影响光标 / 选区 / 拖选。
674 MouseArea {
675 anchors.fill: parent
664 acceptedButtons: Qt.RightButton 676 acceptedButtons: Qt.RightButton
665 gesturePolicy: TapHandler.WithinBounds 677 cursorShape: Qt.IBeamCursor
666 onTapped: promptEditMenu.popup() 678 onClicked: promptEditMenu.popup()
667 } 679 }
668 } 680 }
669 } 681 }
......
...@@ -173,7 +173,18 @@ Rectangle { ...@@ -173,7 +173,18 @@ Rectangle {
173 model: taskQueue.model 173 model: taskQueue.model
174 174
175 ScrollBar.vertical: ScrollBar { 175 ScrollBar.vertical: ScrollBar {
176 id: taskScrollBar
176 policy: ScrollBar.AsNeeded 177 policy: ScrollBar.AsNeeded
178 contentItem: Rectangle {
179 implicitWidth: 8
180 radius: 4
181 color: taskScrollBar.pressed
182 ? App.Theme.borderStrong
183 : (taskScrollBar.hovered
184 ? App.Theme.borderDefault
185 : Qt.rgba(0, 0, 0, 0.18))
186 Behavior on color { ColorAnimation { duration: 100 } }
187 }
177 } 188 }
178 189
179 // 右键菜单上下文:当前点击的任务 id + 状态 190 // 右键菜单上下文:当前点击的任务 id + 状态
......
...@@ -57,9 +57,13 @@ TextField { ...@@ -57,9 +57,13 @@ TextField {
57 } 57 }
58 } 58 }
59 59
60 TapHandler { 60 // TapHandler 在 TextField 内部不可靠(内嵌 TextInput 会先 grab 鼠标),
61 // 改用 MouseArea + acceptedButtons:Qt.RightButton —
62 // 未列出的 LeftButton 会自动透传给下方 TextInput,不影响光标 / 选区。
63 MouseArea {
64 anchors.fill: parent
61 acceptedButtons: Qt.RightButton 65 acceptedButtons: Qt.RightButton
62 gesturePolicy: TapHandler.WithinBounds 66 cursorShape: Qt.IBeamCursor
63 onTapped: editMenu.popup() 67 onClicked: editMenu.popup()
64 } 68 }
65 } 69 }
......