From b7f8086166b155dca2fc76b9c4b54ba11ef23fb3 Mon Sep 17 00:00:00 2001 From: Kellermorph Date: Sat, 22 Aug 2026 11:25:47 +0200 Subject: [PATCH] Fix paste breaking existing conductors --- sources/diagramcommands.cpp | 32 -------------------------------- sources/diagramcommands.h | 2 -- 2 files changed, 34 deletions(-) diff --git a/sources/diagramcommands.cpp b/sources/diagramcommands.cpp index 65273de7a..763f1f987 100644 --- a/sources/diagramcommands.cpp +++ b/sources/diagramcommands.cpp @@ -17,9 +17,7 @@ */ #include "diagramcommands.h" -#include "autobreakconductor.h" #include "diagram.h" -#include "qetproject.h" #include "qetgraphicsitem/conductortextitem.h" #include "qetgraphicsitem/element.h" #include "qetgraphicsitem/elementtextitemgroup.h" @@ -50,7 +48,6 @@ PasteDiagramCommand::PasteDiagramCommand( Diagram *dia, const DiagramContent &c, PasteDiagramCommand::~PasteDiagramCommand() { diagram -> qgiManager().release(content.items(filter)); - delete m_break_cmd; } /** @@ -61,10 +58,6 @@ void PasteDiagramCommand::undo() { diagram -> showMe(); - //Undo auto-break before removing items, so terminals are still on scene - if (m_break_cmd) - m_break_cmd->undo(); - foreach(QGraphicsItem *item, content.items(filter)) diagram->removeItem(item); } @@ -116,27 +109,6 @@ void PasteDiagramCommand::redo() } } } - - //Auto-break conductors on first paste. Items are already on the - //scene at this point (added before this command was created). - if (diagram->project()->autoBreakConductor()) - { - m_break_cmd = new QUndoCommand(); - QList conductors_handled; - QSet used_terminals; - for (Element *e : content.m_elements) { - autoBreakConductors(diagram, e, m_break_cmd, - conductors_handled, used_terminals); - } - if (m_break_cmd->childCount() == 0) { - delete m_break_cmd; - m_break_cmd = nullptr; - } - else - { - m_break_cmd->redo(); - } - } } else { @@ -144,10 +116,6 @@ void PasteDiagramCommand::redo() for (QGraphicsItem *item : qgis_list) { diagram->addItem(item); } - - //Re-execute the stored break commands (items are back on scene) - if (m_break_cmd) - m_break_cmd->redo(); } const QList qgis_list = content.items(); diff --git a/sources/diagramcommands.h b/sources/diagramcommands.h index 5c05e151b..070214b85 100644 --- a/sources/diagramcommands.h +++ b/sources/diagramcommands.h @@ -53,8 +53,6 @@ class PasteDiagramCommand : public QUndoCommand { int filter; /// prevent the first call to redo() bool first_redo; - /// auto-break conductor sub-commands (created on first redo) - QUndoCommand *m_break_cmd = nullptr; }; /**