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); }