Replace AddItemCommand class by AddGraphicsObjectCommand

The class is the same except the name and the use of QPointer to avoid
segfault with deleted QGraphicsObject.
This commit is contained in:
joshua
2021-02-07 16:20:55 +01:00
parent ac23010559
commit 0c4f87bd76
14 changed files with 180 additions and 94 deletions

View File

@@ -21,7 +21,9 @@
#include "../conductorautonumerotation.h"
#include "../diagram.h"
#include "../diagramcommands.h"
#include "../undocommand/addgraphicsobjectcommand.h"
#include "../qetgraphicsitem/element.h"
#include "../qetgraphicsitem/conductor.h"
#include "../ui_multipastedialog.h"
#include <QHash>
@@ -131,7 +133,7 @@ void MultiPasteDialog::on_m_button_box_accepted()
QPair <Terminal *, Terminal *> pair = elmt->AlignedFreeTerminals().takeFirst();
Conductor *conductor = new Conductor(pair.first, pair.second);
m_diagram->undoStack().push(new AddItemCommand<Conductor *>(conductor, m_diagram, QPointF()));
m_diagram->undoStack().push(new AddGraphicsObjectCommand(conductor, m_diagram, QPointF()));
//Autonum the new conductor, the undo command associated for this, have for parent undo_object
ConductorAutoNumerotation can (conductor, m_diagram);