mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-10-19 12:34:15 +02:00
Fix paste breaking existing conductors
This commit is contained in:
@@ -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<Conductor *> conductors_handled;
|
||||
QSet<Terminal *> 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<QGraphicsItem *> qgis_list = content.items();
|
||||
|
||||
Reference in New Issue
Block a user