From eb50a876943d700a164b750da7b17ab832f8e70a Mon Sep 17 00:00:00 2001 From: gaozheng Date: Thu, 25 Jun 2026 12:17:50 +0800 Subject: [PATCH] =?UTF-8?q?fix(ui):=20=E5=8F=B3=E9=94=AE=E8=8F=9C=E5=8D=95?= =?UTF-8?q?=E9=99=90=E4=B8=89=E7=BB=B4=E4=BD=93=E6=AE=B5+=E5=AE=B9?= =?UTF-8?q?=E5=99=A8=E8=8A=82=E7=82=B9=E5=8E=BB=E5=A4=8D=E9=80=89=E6=A1=86?= =?UTF-8?q?+=E5=AE=B9=E5=99=A8=E6=A0=91=E5=89=AA=E6=9E=9D(=E5=8F=AA?= =?UTF-8?q?=E5=B1=95=E7=A4=BA=E6=9C=89=E4=BD=93=E8=B7=AF=E5=BE=84)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/main.cpp | 14 +++++++++++++- src/app/panels/columns/CategorySection.cpp | 13 +++++++++---- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/src/app/main.cpp b/src/app/main.cpp index 60501b7..8e8d197 100644 --- a/src/app/main.cpp +++ b/src/app/main.cpp @@ -486,7 +486,19 @@ void buildWorkbench(QMainWindow& window, geopro::data::LocalSampleRepository& re // 三维体段=从项目根的完整层级树:项目根/GS/TM 容器节点 → 体(挂生成位置) → 切片(挂体) → 异常(挂体/切片)。 // populateDatasetList 按 parentId 自动建树(spec §7/§8)。 std::vector voxelTree; - for (const auto& n : *lastStructNodes) { // 项目根/GS/TM 容器节点(ddCode="container",不可勾选) + // 剪枝:只展示有三维体挂载的容器路径(从体的生成位置向上追溯到根),不带出无关 GS/TM。 + std::map byId; + for (const auto& n : *lastStructNodes) byId[n.id] = &n; + std::set keep; + for (const auto& v : vols) { + std::string p = v.parentId; // 体的生成位置(structParentId) + while (!p.empty() && byId.count(p) && !keep.count(p)) { + keep.insert(p); + p = byId[p]->parentId; // 向上到祖先(GS/项目根) + } + } + for (const auto& n : *lastStructNodes) { // 仅保留有体路径的容器节点(ddCode="container",无复选框) + if (!keep.count(n.id)) continue; geopro::data::DsRow c; c.id = n.id; c.dsName = n.name; diff --git a/src/app/panels/columns/CategorySection.cpp b/src/app/panels/columns/CategorySection.cpp index 45aae93..06b9dcb 100644 --- a/src/app/panels/columns/CategorySection.cpp +++ b/src/app/panels/columns/CategorySection.cpp @@ -87,8 +87,10 @@ CategorySection::CategorySection(const CategorySpec& spec, geopro::data::Dataset if (id.isEmpty()) return; emit detailRequested(id, it->data(0, kDsDdCodeRole).toString(), it->data(0, kDsNameRole).toString()); }); - list_->setContextMenuPolicy(Qt::CustomContextMenu); - connect(list_, &QTreeWidget::customContextMenuRequested, this, &CategorySection::showContextMenu); + if (spec_.id == "voxel") { // 仅三维体段提供右键操作菜单(体/切片/异常) + list_->setContextMenuPolicy(Qt::CustomContextMenu); + connect(list_, &QTreeWidget::customContextMenuRequested, this, &CategorySection::showContextMenu); + } body->addWidget(list_, 1); root->addWidget(body_, 1); @@ -170,8 +172,11 @@ void CategorySection::rebuildList() { const QSignalBlocker block(list_); populateDatasetList(list_, filtered, /*append=*/false); for (QTreeWidgetItemIterator it(list_); *it; ++it) { - // 容器节点(项目根/GS/TM)只作层级骨架,不可勾选。 - if ((*it)->data(0, kDsDdCodeRole).toString() == QStringLiteral("container")) continue; + // 容器节点(项目根/GS/TM)只作层级骨架——明确去掉复选框、不可勾选。 + if ((*it)->data(0, kDsDdCodeRole).toString() == QStringLiteral("container")) { + (*it)->setFlags((*it)->flags() & ~Qt::ItemIsUserCheckable); + continue; + } (*it)->setFlags((*it)->flags() | Qt::ItemIsUserCheckable); (*it)->setCheckState(0, Qt::Unchecked); }