feat(qml): task #16 历史记录 tab 完整重做(ListView + 详情面板)
core/history.py:
HistoryListModel.roleNames() 暴露 4 个 Qt 内置 role 给 QML:
display / decoration / toolTip / timestamp (UserRole)
旧 QListView 用 int role 不受影响
bridges/history.py:
Slot thumbnailPath(timestamp) → str
返回 thumb.jpg 本地路径(按需用 PIL 生成 240px JPEG),缩略图缺失回退原图
qml_poc/qml/HistoryTab.qml (新):
- 左侧 340px 卡片:列表 (history.model)
* delegate 76px 高:60×60 缩略图 + timestamp + prompt 双行摘要
* 选中态 accent 蓝边框 + accentSubtle 浅蓝底
* hover 提示完整 toolTip
- 右侧详情卡片:
* timestamp + createdAt + "在文件管理器中打开" + "删除"
* 360px 大图(双击系统查看器打开)
* GridLayout 4 列元信息(宽高比/尺寸/模型)
* prompt ScrollView(长文本可滚)
- Component.onCompleted + onCountChanged 自动选中第一条
- itemRemoved 信号 → 选中失效时回到空态
qml_poc/main_qml.py:
AppState 加 QML_DEBUG_TAB env var (0/1/2) 控制启动 tab 索引,方便 PoC 调试
MainWindow.qml: 历史记录占位 Item → HistoryTab {}
视觉验证:QML_DEBUG_TAB=2 直接进历史 tab,2 条已存历史正确渲染(缩略图 +
详情大图 + 元信息 + prompt 都对),UI 无回归。
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Showing
5 changed files
with
31 additions
and
12 deletions
qml_poc/qml/HistoryTab.qml
0 → 100644
This diff is collapsed.
Click to expand it.
-
Please register or sign in to post a comment