2017-08-03 17:36:08 +00:00
|
|
|
/*
|
2021-02-06 18:33:42 +01:00
|
|
|
Copyright 2006-2021 The QElectroTech Team
|
2017-08-03 17:36:08 +00:00
|
|
|
This file is part of QElectroTech.
|
2020-09-21 21:19:50 +02:00
|
|
|
|
2017-08-03 17:36:08 +00:00
|
|
|
QElectroTech is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
2020-09-21 21:19:50 +02:00
|
|
|
|
2017-08-03 17:36:08 +00:00
|
|
|
QElectroTech is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
2020-09-21 21:19:50 +02:00
|
|
|
|
2017-08-03 17:36:08 +00:00
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
#ifndef DELETEQGRAPHICSITEMCOMMAND_H
|
|
|
|
#define DELETEQGRAPHICSITEMCOMMAND_H
|
|
|
|
|
2020-12-08 19:57:35 +01:00
|
|
|
#include "../diagramcontent.h"
|
2020-09-21 21:19:50 +02:00
|
|
|
|
2020-12-08 19:57:35 +01:00
|
|
|
#include <QHash>
|
|
|
|
#include <QUndoCommand>
|
2017-08-03 17:36:08 +00:00
|
|
|
|
|
|
|
class Diagram;
|
2017-11-29 14:49:12 +00:00
|
|
|
class ElementTextItemGroup;
|
2019-01-09 18:08:49 +00:00
|
|
|
class Terminal;
|
2020-05-12 11:17:25 +02:00
|
|
|
class QetGraphicsTableItem;
|
2020-06-05 20:00:13 +02:00
|
|
|
class QGraphicsScene;
|
2017-08-03 17:36:08 +00:00
|
|
|
|
|
|
|
class DeleteQGraphicsItemCommand : public QUndoCommand
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
DeleteQGraphicsItemCommand(Diagram *diagram, const DiagramContent &content, QUndoCommand * parent = nullptr);
|
2017-08-05 02:10:01 +00:00
|
|
|
~DeleteQGraphicsItemCommand() override;
|
2020-09-21 21:19:50 +02:00
|
|
|
|
2017-08-03 17:36:08 +00:00
|
|
|
private:
|
|
|
|
DeleteQGraphicsItemCommand(const DeleteQGraphicsItemCommand &);
|
2020-09-21 21:19:50 +02:00
|
|
|
|
2019-01-09 18:08:49 +00:00
|
|
|
void setPotentialsOfRemovedElements();
|
|
|
|
Terminal *terminalInSamePotential(Terminal *terminal, Conductor *conductor_to_exclude);
|
2017-08-03 17:36:08 +00:00
|
|
|
|
|
|
|
public:
|
2017-08-05 02:10:01 +00:00
|
|
|
void undo() override;
|
|
|
|
void redo() override;
|
2020-09-21 21:19:50 +02:00
|
|
|
|
2017-08-03 17:36:08 +00:00
|
|
|
// attributes
|
|
|
|
private:
|
|
|
|
DiagramContent m_removed_contents;
|
|
|
|
Diagram *m_diagram;
|
|
|
|
QHash <Element *, QList<Element *> > m_link_hash; /// keep linked element for each removed element linked to other element.
|
|
|
|
QHash <DynamicElementTextItem *, Element *> m_elmt_text_hash; /// Keep the parent element of each deleted dynamic element text item
|
2017-11-29 14:49:12 +00:00
|
|
|
QHash <DynamicElementTextItem *, ElementTextItemGroup *> m_grp_texts_hash; ///Keep the parent group of each deleted element text item
|
2019-01-09 18:08:49 +00:00
|
|
|
QList <QPair<Terminal *, Terminal *>> m_connected_terminals;
|
2020-06-05 20:00:13 +02:00
|
|
|
QHash <QetGraphicsTableItem *, QPointer<QGraphicsScene>> m_table_scene_hash;
|
|
|
|
bool m_remove_linked_table = false;
|
2017-08-03 17:36:08 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // DELETEQGRAPHICSITEMCOMMAND_H
|