Element editor : improve code

Better use of signal partsAdded and partsRemoved
This commit is contained in:
joshua
2022-07-26 17:03:18 +02:00
parent 5a497cd6b5
commit 57695bbbea
7 changed files with 139 additions and 81 deletions

View File

@@ -34,6 +34,7 @@
#include "graphicspart/partterminal.h"
#include "graphicspart/parttext.h"
#include "../QPropertyUndoCommand/qpropertyundocommand.h"
#include "UndoCommand/deletepartscommand.h"
/**
@@ -71,29 +72,6 @@ class ElementEditionCommand : public QUndoCommand
ElementView *m_view;
};
/**
This command deletes one or several primitives/parts when editing an
electrical element.
*/
class DeletePartsCommand : public ElementEditionCommand {
// constructors, destructor
public:
DeletePartsCommand(ElementScene *, const QList<QGraphicsItem *>&, QUndoCommand * = nullptr);
~DeletePartsCommand() override;
private:
DeletePartsCommand(const DeletePartsCommand &);
// methods
public:
void undo() override;
void redo() override;
// attributes
private:
/// Deleted primitives
QList<QGraphicsItem *> deleted_parts;
};
/**
This command cut primitives when editing an electrical element.
*/