fix(ui): 三维分析分段面板视觉打磨(段头/新增按钮/顶部留白,规范§4.3/§6.7)
用户反馈分段面板难看,逐项重做: - 可折叠段头:去原生小三角(难看)→chevron 文本前缀 ▾/▸(随主题/hover 变色);标题改 title 字号 +半粗(原默认字体);加浅底分段条 bg/panel-subtle + 底分隔线 divider 作视觉分段;hover 转 accent - 「+新增三维体」:裸 autoRaise 文字 → 描边强调按钮(border/文字 accent/primary,hover 浅强调底, radius/sm,caption 字号),符合§6.7 次级强调按钮 - 顶部留白:CategoryAnalysisTab 内容区加 top margin → 首段段头不再贴顶 - 筛选行 setSpacing 一致化 构建:app 链接通过
This commit is contained in:
parent
fb911a9d85
commit
d6e52cb51f
|
|
@ -22,7 +22,7 @@ CategoryAnalysisTab::CategoryAnalysisTab(geopro::data::DatasetFieldDictionary* d
|
||||||
|
|
||||||
auto* content = new QWidget(scroll);
|
auto* content = new QWidget(scroll);
|
||||||
auto* col = new QVBoxLayout(content);
|
auto* col = new QVBoxLayout(content);
|
||||||
col->setContentsMargins(0, 0, 0, 0);
|
col->setContentsMargins(0, space::kSm, 0, space::kSm); // 顶部留白:首段段头不贴顶
|
||||||
col->setSpacing(space::kSm);
|
col->setSpacing(space::kSm);
|
||||||
|
|
||||||
for (const CategorySpec& spec : categoryConfigs()) {
|
for (const CategorySpec& spec : categoryConfigs()) {
|
||||||
|
|
|
||||||
|
|
@ -33,24 +33,50 @@ CategorySection::CategorySection(const CategorySpec& spec, geopro::data::Dataset
|
||||||
root->setContentsMargins(0, 0, 0, 0);
|
root->setContentsMargins(0, 0, 0, 0);
|
||||||
root->setSpacing(0);
|
root->setSpacing(0);
|
||||||
|
|
||||||
// 数据类型标题行(spec §7):折叠箭头+标题(左) | 「+新增三维体」(右,仅反演类,在标题行而非筛选行)。
|
// 数据类型段头(可折叠,规范§4.3/§6):chevron + 标题(title 字号·半粗) |「+ 新增三维体」(右,仅反演类)。
|
||||||
|
// 段头加浅底 + 底分隔线作视觉分段;去原生小三角(难看)→chevron 文本前缀,随主题/hover 变色。
|
||||||
auto* headerRow = new QWidget(this);
|
auto* headerRow = new QWidget(this);
|
||||||
|
headerRow->setObjectName(QStringLiteral("secHeader"));
|
||||||
|
applyTokenizedStyleSheet(headerRow,
|
||||||
|
QStringLiteral("QWidget#secHeader{background:{{bg/panel-subtle}};"
|
||||||
|
"border-bottom:1px solid {{divider}};}"));
|
||||||
auto* hl = new QHBoxLayout(headerRow);
|
auto* hl = new QHBoxLayout(headerRow);
|
||||||
hl->setContentsMargins(space::kSm, 0, space::kSm, 0);
|
hl->setContentsMargins(space::kMd, space::kSm, space::kSm, space::kSm);
|
||||||
hl->setSpacing(space::kSm);
|
hl->setSpacing(space::kSm);
|
||||||
header_ = new QToolButton(headerRow);
|
header_ = new QToolButton(headerRow);
|
||||||
header_->setText(QString::fromStdString(spec_.title));
|
|
||||||
header_->setCheckable(true);
|
header_->setCheckable(true);
|
||||||
header_->setChecked(true);
|
header_->setChecked(true);
|
||||||
header_->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
|
header_->setArrowType(Qt::NoArrow);
|
||||||
header_->setArrowType(Qt::DownArrow);
|
header_->setToolButtonStyle(Qt::ToolButtonTextOnly);
|
||||||
header_->setAutoRaise(true);
|
header_->setCursor(Qt::PointingHandCursor);
|
||||||
|
applyTokenizedStyleSheet(
|
||||||
|
header_, QStringLiteral("QToolButton{border:none;background:transparent;padding:0;"
|
||||||
|
"font-size:%1px;font-weight:%2;color:{{text/primary}};}"
|
||||||
|
"QToolButton:hover{color:{{accent/primary}};}")
|
||||||
|
.arg(scaledPx(type::kTitle))
|
||||||
|
.arg(type::kWeightSemibold));
|
||||||
|
auto syncHeader = [this] {
|
||||||
|
header_->setText((header_->isChecked() ? QStringLiteral("▾ ") : QStringLiteral("▸ "))
|
||||||
|
+ QString::fromStdString(spec_.title));
|
||||||
|
};
|
||||||
|
syncHeader();
|
||||||
hl->addWidget(header_);
|
hl->addWidget(header_);
|
||||||
hl->addStretch(1);
|
hl->addStretch(1);
|
||||||
if (spec_.canGenerateVolume) {
|
if (spec_.canGenerateVolume) {
|
||||||
auto* gen = new QToolButton(headerRow);
|
auto* gen = new QToolButton(headerRow);
|
||||||
gen->setText(QStringLiteral("+ 新增三维体"));
|
gen->setText(QStringLiteral("+ 新增三维体"));
|
||||||
gen->setAutoRaise(true);
|
gen->setCursor(Qt::PointingHandCursor);
|
||||||
|
// 次级强调按钮(规范§6.7):描边 accent + accent 文字,hover 浅强调底;非裸文字。
|
||||||
|
applyTokenizedStyleSheet(
|
||||||
|
gen, QStringLiteral(
|
||||||
|
"QToolButton{border:1px solid {{accent/primary}};border-radius:%1px;"
|
||||||
|
"color:{{accent/primary}};background:transparent;padding:%2px %3px;font-size:%4px;}"
|
||||||
|
"QToolButton:hover{background:{{bg/selected}};}"
|
||||||
|
"QToolButton:pressed{background:{{bg/hover}};}")
|
||||||
|
.arg(radius::kSm)
|
||||||
|
.arg(scaledPx(space::kXxs))
|
||||||
|
.arg(scaledPx(space::kMd))
|
||||||
|
.arg(scaledPx(type::kCaption)));
|
||||||
connect(gen, &QToolButton::clicked, this, [this] {
|
connect(gen, &QToolButton::clicked, this, [this] {
|
||||||
emit generateVolumeRequested(QString::fromStdString(spec_.dsTypeCode), checkedDsIds());
|
emit generateVolumeRequested(QString::fromStdString(spec_.dsTypeCode), checkedDsIds());
|
||||||
});
|
});
|
||||||
|
|
@ -65,6 +91,7 @@ CategorySection::CategorySection(const CategorySpec& spec, geopro::data::Dataset
|
||||||
|
|
||||||
// 筛选行:采集时间范围(在前)+ 装置类型(在后,仅 ERT 类)。
|
// 筛选行:采集时间范围(在前)+ 装置类型(在后,仅 ERT 类)。
|
||||||
auto* filterRow = new QHBoxLayout();
|
auto* filterRow = new QHBoxLayout();
|
||||||
|
filterRow->setSpacing(space::kSm);
|
||||||
dateRange_ = new DateRangeEdit(body_);
|
dateRange_ = new DateRangeEdit(body_);
|
||||||
connect(dateRange_, &DateRangeEdit::rangeChanged, this, [this] { rebuildList(); });
|
connect(dateRange_, &DateRangeEdit::rangeChanged, this, [this] { rebuildList(); });
|
||||||
filterRow->addWidget(dateRange_, 1);
|
filterRow->addWidget(dateRange_, 1);
|
||||||
|
|
@ -115,9 +142,9 @@ CategorySection::CategorySection(const CategorySpec& spec, geopro::data::Dataset
|
||||||
|
|
||||||
root->addWidget(body_, 1);
|
root->addWidget(body_, 1);
|
||||||
|
|
||||||
connect(header_, &QToolButton::toggled, this, [this](bool on) {
|
connect(header_, &QToolButton::toggled, this, [this, syncHeader](bool on) {
|
||||||
body_->setVisible(on);
|
body_->setVisible(on);
|
||||||
header_->setArrowType(on ? Qt::DownArrow : Qt::RightArrow);
|
syncHeader(); // ▾(展开)/▸(折叠) 切换
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue