From b153665059f64a8276e62d2c4b7c297c25cc0d98 Mon Sep 17 00:00:00 2001 From: Sen66 Date: Fri, 13 Feb 2026 02:27:01 +0100 Subject: [PATCH] Properly delete selected nodes --- src/main.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index eb58f2a..46247bd 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -722,17 +722,17 @@ void MainWindow::removeNode() { auto* ctrl = activeController(); if (!ctrl) return; auto* primary = activePaneEditor(); - if (!primary || primary->isEditing()) return; - QSet indices = primary->selectedNodeIndices(); - if (indices.size() > 1) { -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) - ctrl->batchRemoveNodes(indices.values()); -#else - ctrl->batchRemoveNodes(indices.values().toVector()); -#endif - } else if (indices.size() == 1) { - ctrl->removeNode(*indices.begin()); + if (primary && primary->isEditing()) return; + QSet ids = ctrl->selectedIds(); + QVector indices; + for (uint64_t id : ids) { + int idx = ctrl->document()->tree.indexOfId(id & ~kFooterIdBit); + if (idx >= 0) indices.append(idx); } + if (indices.size() > 1) + ctrl->batchRemoveNodes(indices); + else if (indices.size() == 1) + ctrl->removeNode(indices.first()); } void MainWindow::changeNodeType() {