feat/vtk-3d-view #7

Merged
gaozheng merged 301 commits from feat/vtk-3d-view into main 2026-06-27 18:43:52 +08:00
2 changed files with 37 additions and 10 deletions
Showing only changes of commit d6e52cb51f - Show all commits

View File

@ -22,7 +22,7 @@ CategoryAnalysisTab::CategoryAnalysisTab(geopro::data::DatasetFieldDictionary* d
auto* content = new QWidget(scroll);
auto* col = new QVBoxLayout(content);
col->setContentsMargins(0, 0, 0, 0);
col->setContentsMargins(0, space::kSm, 0, space::kSm); // 顶部留白:首段段头不贴顶
col->setSpacing(space::kSm);
for (const CategorySpec& spec : categoryConfigs()) {

View File

@ -33,24 +33,50 @@ CategorySection::CategorySection(const CategorySpec& spec, geopro::data::Dataset
root->setContentsMargins(0, 0, 0, 0);
root->setSpacing(0);
// 数据类型标题行spec §7折叠箭头+标题(左) | 「+新增三维体」(右,仅反演类,在标题行而非筛选行)。
// 数据类型段头可折叠规范§4.3/§6chevron + 标题(title 字号·半粗) |「+ 新增三维体」(右,仅反演类)。
// 段头加浅底 + 底分隔线作视觉分段;去原生小三角(难看)→chevron 文本前缀,随主题/hover 变色。
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);
hl->setContentsMargins(space::kSm, 0, space::kSm, 0);
hl->setContentsMargins(space::kMd, space::kSm, space::kSm, space::kSm);
hl->setSpacing(space::kSm);
header_ = new QToolButton(headerRow);
header_->setText(QString::fromStdString(spec_.title));
header_->setCheckable(true);
header_->setChecked(true);
header_->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
header_->setArrowType(Qt::DownArrow);
header_->setAutoRaise(true);
header_->setArrowType(Qt::NoArrow);
header_->setToolButtonStyle(Qt::ToolButtonTextOnly);
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->addStretch(1);
if (spec_.canGenerateVolume) {
auto* gen = new QToolButton(headerRow);
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] {
emit generateVolumeRequested(QString::fromStdString(spec_.dsTypeCode), checkedDsIds());
});
@ -65,6 +91,7 @@ CategorySection::CategorySection(const CategorySpec& spec, geopro::data::Dataset
// 筛选行:采集时间范围(在前)+ 装置类型(在后,仅 ERT 类)。
auto* filterRow = new QHBoxLayout();
filterRow->setSpacing(space::kSm);
dateRange_ = new DateRangeEdit(body_);
connect(dateRange_, &DateRangeEdit::rangeChanged, this, [this] { rebuildList(); });
filterRow->addWidget(dateRange_, 1);
@ -115,9 +142,9 @@ CategorySection::CategorySection(const CategorySpec& spec, geopro::data::Dataset
root->addWidget(body_, 1);
connect(header_, &QToolButton::toggled, this, [this](bool on) {
connect(header_, &QToolButton::toggled, this, [this, syncHeader](bool on) {
body_->setVisible(on);
header_->setArrowType(on ? Qt::DownArrow : Qt::RightArrow);
syncHeader(); // ▾(展开)/▸(折叠) 切换
});
}