fix(ela): 页签与工具条统一为同一套切换样式(消除三套不一致)

PanelHeader 页签(数据/文件, 异常列表/对象属性)从 ElaToolButton 退回 QToolButton, headerQss
恢复 tabBtn 下划线规则: 选中 = 强调色文字 + 2px 强调色下划线 — 与视图/详情工具条完全一致。
至此全 UI 的切换控件(页签 + 分段工具条)是同一种视觉语言。
This commit is contained in:
gaozheng 2026-06-10 11:51:02 +08:00
parent 107fed8182
commit 464911dc57
1 changed files with 11 additions and 5 deletions

View File

@ -30,8 +30,8 @@ constexpr int kTabIcon = 19; // Tab 图标
// 面板标题=title(15)、徽标=caption(12)、Tab 文本=body(13),加粗统一 semibold。 // 面板标题=title(15)、徽标=caption(12)、Tab 文本=body(13),加粗统一 semibold。
// #panelBadge 为中性计数徽标;#panelBadgeWarn 为“需注意”变体(语义 warning 色), // #panelBadge 为中性计数徽标;#panelBadgeWarn 为“需注意”变体(语义 warning 色),
// 供异常计数等承载“待复查”含义的徽标使用(调用方改 objectName 即切换)。 // 供异常计数等承载“待复查”含义的徽标使用(调用方改 objectName 即切换)。
// 表头底/标题/徽标样式。Tab(ElaToolButton)与操作按钮(ElaIconButton)自绘 Fluent // 表头底/标题/徽标 + 页签样式。页签选中态 = 强调色文字 + 2px 强调色下划线
// 不再写它们的 QSS选中态由 Ela 的 checked 高亮表达,而非自定义下划线) // 与视图/详情工具条完全一致(全 UI 切换控件统一这一套)。操作按钮(ElaIconButton)自绘 Fluent
QString headerQss() QString headerQss()
{ {
return QStringLiteral( return QStringLiteral(
@ -40,12 +40,18 @@ QString headerQss()
"#panelBadge { background:#EAEEF5; color:#5A6B85; border-radius:9px;" "#panelBadge { background:#EAEEF5; color:#5A6B85; border-radius:9px;"
" padding:1px 7px; font-size:%2px; font-weight:%3; }" " padding:1px 7px; font-size:%2px; font-weight:%3; }"
"#panelBadgeWarn { background:%4; color:%5; border-radius:9px;" "#panelBadgeWarn { background:%4; color:%5; border-radius:9px;"
" padding:1px 7px; font-size:%2px; font-weight:%3; }") " padding:1px 7px; font-size:%2px; font-weight:%3; }"
"QToolButton#tabBtn { border:none; border-bottom:2px solid transparent; color:#5A6B85;"
" padding:8px 6px; font-size:%6px; }"
"QToolButton#tabBtn:hover { color:#1F2A3D; }"
"QToolButton#tabBtn:checked { color:#2D6CB5; font-weight:%3;"
" border-bottom:2px solid #2D6CB5; }")
.arg(type::kTitle) .arg(type::kTitle)
.arg(type::kCaption) .arg(type::kCaption)
.arg(type::kWeightSemibold) .arg(type::kWeightSemibold)
.arg(QString::fromUtf8(semantic::kWarningFill)) .arg(QString::fromUtf8(semantic::kWarningFill))
.arg(QString::fromUtf8(semantic::kWarning)); .arg(QString::fromUtf8(semantic::kWarning))
.arg(type::kBody);
} }
// 数量徽标(默认隐藏,调用方 setText+setVisible 显示)。 // 数量徽标(默认隐藏,调用方 setText+setVisible 显示)。
@ -135,7 +141,7 @@ TabbedPanel buildTabbedPanel(const QVector<PanelTab>& tabs, const QVector<Header
for (int i = 0; i < tabs.size(); ++i) { for (int i = 0; i < tabs.size(); ++i) {
const PanelTab& t = tabs[i]; const PanelTab& t = tabs[i];
auto* btn = new ElaToolButton(header); // Fluent tab(选中态由 Ela checked 高亮) auto* btn = new QToolButton(header); // 页签与工具条统一: QToolButton + 强调色下划线 QSS
btn->setObjectName(QStringLiteral("tabBtn")); btn->setObjectName(QStringLiteral("tabBtn"));
btn->setText(t.title); btn->setText(t.title);
setThemedGlyph(btn, t.icon, kTabIcon); // 随主题着色 setThemedGlyph(btn, t.icon, kTabIcon); // 随主题着色