Element editor : improve code

Better use of signal partsAdded and partsRemoved
This commit is contained in:
joshua
2022-07-26 16:17:47 +02:00
parent cae7cbdbd8
commit 5a497cd6b5
17 changed files with 192 additions and 99 deletions

View File

@@ -132,30 +132,6 @@ class MovePartsCommand : public ElementEditionCommand {
bool first_redo;
};
/**
This command adds a primitive when editing an electrical element.
*/
class AddPartCommand : public ElementEditionCommand {
// constructors, destructor
public:
AddPartCommand(const QString &, ElementScene *, QGraphicsItem *, QUndoCommand * = nullptr);
~AddPartCommand() override;
private:
AddPartCommand(const AddPartCommand &);
// methods
public:
void undo() override;
void redo() override;
// attributes
private:
/// Added primitive
QGraphicsItem *part;
/// Prevent the first call to redo()
bool first_redo;
};
/**
This command changes the translated names of an electrical element.
*/
@@ -311,5 +287,4 @@ private:
};
#endif