QElectroTech  0.70
deleteqgraphicsitemcommand.h
Go to the documentation of this file.
1 /*
2  Copyright 2006-2019 The QElectroTech Team
3  This file is part of QElectroTech.
4 
5  QElectroTech is free software: you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation, either version 2 of the License, or
8  (at your option) any later version.
9 
10  QElectroTech is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
17 */
18 #ifndef DELETEQGRAPHICSITEMCOMMAND_H
19 #define DELETEQGRAPHICSITEMCOMMAND_H
20 
21 #include <QUndoCommand>
22 #include "diagramcontent.h"
23 
24 class Diagram;
26 class Terminal;
27 
28 class DeleteQGraphicsItemCommand : public QUndoCommand
29 {
30  public:
31  DeleteQGraphicsItemCommand(Diagram *diagram, const DiagramContent &content, QUndoCommand * parent = nullptr);
32  ~DeleteQGraphicsItemCommand() override;
33 
34  private:
36 
38  Terminal *terminalInSamePotential(Terminal *terminal, Conductor *conductor_to_exclude);
39 
40  public:
41  void undo() override;
42  void redo() override;
43 
44  // attributes
45  private:
48  QHash <Element *, QList<Element *> > m_link_hash;
49  QHash <DynamicElementTextItem *, Element *> m_elmt_text_hash;
50  QHash <DynamicElementTextItem *, ElementTextItemGroup *> m_grp_texts_hash;
51  QList <QPair<Terminal *, Terminal *>> m_connected_terminals;
52 };
53 
54 #endif // DELETEQGRAPHICSITEMCOMMAND_H
void undo() override
DeleteQGraphicsItemCommand::undo Undo this command.
QList< QPair< Terminal *, Terminal * > > m_connected_terminals
Keep the parent group of each deleted element text item.
QHash< Element *, QList< Element * > > m_link_hash
The ElementTextItemGroup class This class represent a group of element text Texts in the group can be...
QHash< DynamicElementTextItem *, ElementTextItemGroup * > m_grp_texts_hash
Keep the parent element of each deleted dynamic element text item.
QHash< DynamicElementTextItem *, Element * > m_elmt_text_hash
keep linked element for each removed element linked to other element.
void setPotentialsOfRemovedElements()
DeleteQGraphicsItemCommand::setPotentialsOfRemovedElements This function creates new conductors (if n...
void redo() override
DeleteQGraphicsItemCommand::redo Redo the delete command.
DeleteQGraphicsItemCommand(Diagram *diagram, const DiagramContent &content, QUndoCommand *parent=nullptr)
DeleteQGraphicsItemCommand::DeleteQGraphicsItemCommand.
Terminal * terminalInSamePotential(Terminal *terminal, Conductor *conductor_to_exclude)
DeleteQGraphicsItemCommand::terminalInSamePotential Return a terminal at the same potential of ...