Skip to content

[0185] Chat 侧边栏欢迎内容居中偏上调整#3603

Merged
da-liii merged 7 commits into
mainfrom
da/0185/chat_side
Jun 1, 2026
Merged

[0185] Chat 侧边栏欢迎内容居中偏上调整#3603
da-liii merged 7 commits into
mainfrom
da/0185/chat_side

Conversation

@da-liii
Copy link
Copy Markdown
Contributor

@da-liii da-liii commented Jun 1, 2026

修改内容

  • 调整 ChatConversationPanel 欢迎模式的竖直布局策略,使其在 Chat 标签页和 Chat 侧边栏(dock)模式下都能将"欢迎使用 Liii STEM"和输入框置于容器中心偏上位置。
  • resizeEvent 中计算顶部偏移的比例从 2/5 调整为 2/7

实现方式

  • 重写 ChatConversationPanel::resizeEvent(),在欢迎模式下根据面板高度动态计算顶部 spacer 高度,使内容位于容器高度的 2/7 处。
  • 窗口大小变化时自动重新计算,无需内部弹性空间。
  • 进入会话模式后,topSpacer_ 收缩为固定小偏移,不影响消息区域展开。

测试

  • 单元测试 qt_chat_tab_widget_test 82/82 全部通过。
  • 编译 xmake b stem 通过。

🤖 Generated with Claude Code

da-liii and others added 7 commits June 1, 2026 18:17
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
- 将 contentLayout 顶部固定偏移(240px)改为 0,消除硬编码偏移。
- 在 topPanel 内部添加顶部和底部弹性空间(QSpacerItem,stretch 比例 2:1),
  利用 Qt 布局自适应能力将欢迎内容推到中心偏上。
- 进入会话模式时,将内部弹性空间收缩为 0,避免挤压消息区域。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
- 将 topInnerSpacer_ 的 size hint 从 0 改为 120px,确保小窗口下也有足够顶部偏移。
- 将 inner spacer stretch 比例从 2:1 调整为 1:1,使内容更稳定在 2/5 位置。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
- 移除 topPanel 内部的固定/弹性混合 spacer 方案。
- 改为在 resizeEvent 中根据 ChatConversationPanel 当前高度动态计算
  topSpacer_ 的固定偏移:height * 2/5 - marginY。
- 确保在不同窗口高度下,欢迎内容始终稳定在容器高度的 2/5 处。
- 进入会话模式时 topSpacer_ 恢复为 8px,不影响消息区域展开。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
将 resizeEvent 中计算顶部偏移的比例从 2/5 调整为 2/7,
使欢迎内容在 Chat 标签页和 dock 侧边栏模式下
都位于容器中心稍稍偏上的位置。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

@JackYansongLi JackYansongLi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@da-liii da-liii merged commit 5506125 into main Jun 1, 2026
4 checks passed
@da-liii da-liii deleted the da/0185/chat_side branch June 1, 2026 12:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants