QElectroTech 0.100.0-dev
Loading...
Searching...
No Matches
deleteqgraphicsitemcommand.h
Go to the documentation of this file.
1/*
2 Copyright 2006-2024 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 "../diagramcontent.h"
22
23#include <QHash>
24#include <QUndoCommand>
25
26class Diagram;
28class Terminal;
30class QGraphicsScene;
31
32class DeleteQGraphicsItemCommand : public QUndoCommand
33{
34 public:
35 DeleteQGraphicsItemCommand(Diagram *diagram, const DiagramContent &content, QUndoCommand * parent = nullptr);
37
38 private:
40
42 Terminal *terminalInSamePotential(Terminal *terminal, Conductor *conductor_to_exclude);
43
44 public:
45 void undo() override;
46 void redo() override;
47
48 // attributes
49 private:
52 QHash <Element *, QList<Element *> > m_link_hash;
53 QHash <DynamicElementTextItem *, Element *> m_elmt_text_hash;
54 QHash <DynamicElementTextItem *, ElementTextItemGroup *> m_grp_texts_hash;
55 QList <QPair<Terminal *, Terminal *>> m_connected_terminals;
56 QHash <QetGraphicsTableItem *, QPointer<QGraphicsScene>> m_table_scene_hash;
58};
59
60#endif // DELETEQGRAPHICSITEMCOMMAND_H
Definition conductor.h:43
Definition deleteqgraphicsitemcommand.h:33
void setPotentialsOfRemovedElements()
DeleteQGraphicsItemCommand::setPotentialsOfRemovedElements This function creates new conductors (if n...
Definition deleteqgraphicsitemcommand.cpp:123
QHash< Element *, QList< Element * > > m_link_hash
Definition deleteqgraphicsitemcommand.h:52
bool m_remove_linked_table
Definition deleteqgraphicsitemcommand.h:57
QList< QPair< Terminal *, Terminal * > > m_connected_terminals
Keep the parent group of each deleted element text item.
Definition deleteqgraphicsitemcommand.h:55
void redo() override
DeleteQGraphicsItemCommand::redo Redo the delete command.
Definition deleteqgraphicsitemcommand.cpp:291
Terminal * terminalInSamePotential(Terminal *terminal, Conductor *conductor_to_exclude)
DeleteQGraphicsItemCommand::terminalInSamePotential Return a terminal at the same potential of termin...
Definition deleteqgraphicsitemcommand.cpp:223
QHash< DynamicElementTextItem *, ElementTextItemGroup * > m_grp_texts_hash
Keep the parent element of each deleted dynamic element text item.
Definition deleteqgraphicsitemcommand.h:54
QHash< QetGraphicsTableItem *, QPointer< QGraphicsScene > > m_table_scene_hash
Definition deleteqgraphicsitemcommand.h:56
~DeleteQGraphicsItemCommand() override
Definition deleteqgraphicsitemcommand.cpp:113
void undo() override
DeleteQGraphicsItemCommand::undo Undo this command.
Definition deleteqgraphicsitemcommand.cpp:253
QHash< DynamicElementTextItem *, Element * > m_elmt_text_hash
keep linked element for each removed element linked to other element.
Definition deleteqgraphicsitemcommand.h:53
DeleteQGraphicsItemCommand(const DeleteQGraphicsItemCommand &)
Diagram * m_diagram
Definition deleteqgraphicsitemcommand.h:51
DiagramContent m_removed_contents
Definition deleteqgraphicsitemcommand.h:50
Definition diagramcontent.h:47
The Diagram class This class represents an electric diagram. It manages its various child elements,...
Definition diagram.h:56
The ElementTextItemGroup class This class represent a group of element text Texts in the group can be...
Definition elementtextitemgroup.h:36
The QetGraphicsTableItem class This item display a table destined to represent the content of a QAbst...
Definition qetgraphicstableitem.h:43
The Terminal class This class represents a terminal of an electrical element, i.e....
Definition terminal.h:36