Properly delete selected nodes

This commit is contained in:
Sen66
2026-02-13 02:27:01 +01:00
parent a88b584ca0
commit b153665059

View File

@@ -722,17 +722,17 @@ void MainWindow::removeNode() {
auto* ctrl = activeController(); auto* ctrl = activeController();
if (!ctrl) return; if (!ctrl) return;
auto* primary = activePaneEditor(); auto* primary = activePaneEditor();
if (!primary || primary->isEditing()) return; if (primary && primary->isEditing()) return;
QSet<int> indices = primary->selectedNodeIndices(); QSet<uint64_t> ids = ctrl->selectedIds();
if (indices.size() > 1) { QVector<int> indices;
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) for (uint64_t id : ids) {
ctrl->batchRemoveNodes(indices.values()); int idx = ctrl->document()->tree.indexOfId(id & ~kFooterIdBit);
#else if (idx >= 0) indices.append(idx);
ctrl->batchRemoveNodes(indices.values().toVector());
#endif
} else if (indices.size() == 1) {
ctrl->removeNode(*indices.begin());
} }
if (indices.size() > 1)
ctrl->batchRemoveNodes(indices);
else if (indices.size() == 1)
ctrl->removeNode(indices.first());
} }
void MainWindow::changeNodeType() { void MainWindow::changeNodeType() {