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 {
id: historyList
Layout.fillWidth: true
Layout.fillHeight: true
Layout.rightMargin: 4 // 给 ScrollBar 留视觉空间
visible: count > 0
spacing: 4
clip: true
model: history.model
ScrollBar.vertical: ScrollBar {
policy: ScrollBar.AsNeeded
id: historyScrollBar
policy: ScrollBar.AlwaysOn
// 默认 Basic 主题滚动条太细 — 自定义 contentItem,
// 8px 常驻 + hover/press 加深,扫一眼就看见。
contentItem: Rectangle {
implicitWidth: 8
radius: 4
color: historyScrollBar.pressed
? App.Theme.borderStrong
: (historyScrollBar.hovered
? App.Theme.borderDefault
: Qt.rgba(0, 0, 0, 0.18))
Behavior on color { ColorAnimation { duration: 100 } }
}
}
delegate: Rectangle {
......
......@@ -412,6 +412,14 @@ Item {
id: hoverHandler
cursorShape: dragHandler.active ? Qt.ClosedHandCursor : Qt.OpenHandCursor
}
// 双击系统查看器打开(与历史 / 预览一致)。
// TapHandler 与 DragHandler 在 Qt Pointer Handler 框架里和平共存:
// 单 / 双击 release 时 dragHandler.active==false,触发 onDoubleTapped;
// 一旦超 8px 阈值进入 drag,TapHandler 自动放弃。
TapHandler {
acceptedButtons: Qt.LeftButton
onDoubleTapped: Qt.openUrlExternally("file:///" + modelData)
}
DragHandler {
id: dragHandler
target: null // 自己不移动 delegate;ghost 单独绘制
......@@ -660,10 +668,14 @@ Item {
}
}
TapHandler {
// TapHandler 在 TextArea 内部不可靠(内嵌 TextEdit 先 grab 鼠标),
// 改用 MouseArea + acceptedButtons:Qt.RightButton —
// 未列出的 LeftButton 自动透传给 TextEdit,不影响光标 / 选区 / 拖选。
MouseArea {
anchors.fill: parent
acceptedButtons: Qt.RightButton
gesturePolicy: TapHandler.WithinBounds
onTapped: promptEditMenu.popup()
cursorShape: Qt.IBeamCursor
onClicked: promptEditMenu.popup()
}
}
}
......
......@@ -173,7 +173,18 @@ Rectangle {
model: taskQueue.model
ScrollBar.vertical: ScrollBar {
id: taskScrollBar
policy: ScrollBar.AsNeeded
contentItem: Rectangle {
implicitWidth: 8
radius: 4
color: taskScrollBar.pressed
? App.Theme.borderStrong
: (taskScrollBar.hovered
? App.Theme.borderDefault
: Qt.rgba(0, 0, 0, 0.18))
Behavior on color { ColorAnimation { duration: 100 } }
}
}
// 右键菜单上下文:当前点击的任务 id + 状态
......
......@@ -57,9 +57,13 @@ TextField {
}
}
TapHandler {
// TapHandler 在 TextField 内部不可靠(内嵌 TextInput 会先 grab 鼠标),
// 改用 MouseArea + acceptedButtons:Qt.RightButton —
// 未列出的 LeftButton 会自动透传给下方 TextInput,不影响光标 / 选区。
MouseArea {
anchors.fill: parent
acceptedButtons: Qt.RightButton
gesturePolicy: TapHandler.WithinBounds
onTapped: editMenu.popup()
cursorShape: Qt.IBeamCursor
onClicked: editMenu.popup()
}
}
......