QElectroTech
0.70
|
#include <deleteqgraphicsitemcommand.h>
Public Member Functions | |
DeleteQGraphicsItemCommand (Diagram *diagram, const DiagramContent &content, QUndoCommand *parent=nullptr) | |
DeleteQGraphicsItemCommand::DeleteQGraphicsItemCommand. More... | |
~DeleteQGraphicsItemCommand () override | |
void | undo () override |
DeleteQGraphicsItemCommand::undo Undo this command. More... | |
void | redo () override |
DeleteQGraphicsItemCommand::redo Redo the delete command. More... | |
Private Member Functions | |
DeleteQGraphicsItemCommand (const DeleteQGraphicsItemCommand &) | |
void | setPotentialsOfRemovedElements () |
DeleteQGraphicsItemCommand::setPotentialsOfRemovedElements This function creates new conductors (if needed) for conserve the electrical potentials present at the terminals of each removed elements. More... | |
Terminal * | terminalInSamePotential (Terminal *terminal, Conductor *conductor_to_exclude) |
DeleteQGraphicsItemCommand::terminalInSamePotential Return a terminal at the same potential of , by traveling through the conductors connected to only if the owner element of the terminal is not delete by this undo command. Return nullptr if a terminal can't be found. More... | |
Private Attributes | |
DiagramContent | m_removed_contents |
Diagram * | m_diagram |
QHash< Element *, QList< Element * > > | m_link_hash |
QHash< DynamicElementTextItem *, Element * > | m_elmt_text_hash |
keep linked element for each removed element linked to other element. More... | |
QHash< DynamicElementTextItem *, ElementTextItemGroup * > | m_grp_texts_hash |
Keep the parent element of each deleted dynamic element text item. More... | |
QList< QPair< Terminal *, Terminal * > > | m_connected_terminals |
Keep the parent group of each deleted element text item. More... | |
Definition at line 28 of file deleteqgraphicsitemcommand.h.
DeleteQGraphicsItemCommand::DeleteQGraphicsItemCommand | ( | Diagram * | diagram, |
const DiagramContent & | content, | ||
QUndoCommand * | parent = nullptr |
||
) |
DeleteQGraphicsItemCommand::DeleteQGraphicsItemCommand.
diagram | : deigram where this undo work |
content | : content to remove |
parent | : parent undo |
Definition at line 35 of file deleteqgraphicsitemcommand.cpp.
References DiagramContent::All, DiagramContent::items(), m_diagram, DiagramContent::m_element_texts, DiagramContent::m_elements, m_elmt_text_hash, m_grp_texts_hash, m_removed_contents, DiagramContent::m_texts_groups, QGIManager::manage(), ElementTextItemGroup::parentElement(), DynamicElementTextItem::parentElement(), DynamicElementTextItem::parentGroup(), Diagram::qgiManager(), DiagramContent::sentence(), setPotentialsOfRemovedElements(), and QET::Icons::tr.
|
override |
Definition at line 81 of file deleteqgraphicsitemcommand.cpp.
References DiagramContent::All, DiagramContent::items(), m_diagram, m_removed_contents, Diagram::qgiManager(), and QGIManager::release().
|
private |
|
override |
DeleteQGraphicsItemCommand::redo Redo the delete command.
Definition at line 240 of file deleteqgraphicsitemcommand.cpp.
References DiagramContent::AnyConductor, DiagramContent::conductors(), DiagramContent::items(), Element::linkedElements(), m_diagram, DiagramContent::m_element_texts, DiagramContent::m_elements, m_link_hash, m_removed_contents, ElementTextItemGroup::parentElement(), DynamicElementTextItem::parentElement(), DynamicElementTextItem::parentGroup(), Element::removeDynamicTextItem(), Diagram::removeItem(), and Element::removeTextFromGroup().
|
private |
DeleteQGraphicsItemCommand::setPotentialsOfRemovedElements This function creates new conductors (if needed) for conserve the electrical potentials present at the terminals of each removed elements.
Definition at line 90 of file deleteqgraphicsitemcommand.cpp.
References QET::Icons::Conductor, Terminal::conductors(), Conductor::diagram(), DiagramContent::Elements, DiagramContent::items(), m_connected_terminals, DiagramContent::m_elements, m_removed_contents, Terminal::parentElement(), Conductor::setProperties(), terminalInSamePotential(), and Element::terminals().
Referenced by DeleteQGraphicsItemCommand().
|
private |
DeleteQGraphicsItemCommand::terminalInSamePotential Return a terminal at the same potential of , by traveling through the conductors connected to only if the owner element of the terminal is not delete by this undo command. Return nullptr if a terminal can't be found.
terminal | - terminal from search |
conductor_to_exclude | - a conductor to exlcude from search. |
Definition at line 181 of file deleteqgraphicsitemcommand.cpp.
References Terminal::conductors(), DiagramContent::Elements, DiagramContent::items(), m_removed_contents, and Terminal::parentElement().
Referenced by setPotentialsOfRemovedElements().
|
override |
DeleteQGraphicsItemCommand::undo Undo this command.
Definition at line 209 of file deleteqgraphicsitemcommand.cpp.
References Element::addDynamicTextItem(), Diagram::addItem(), Element::addTextToGroup(), DiagramContent::items(), m_diagram, DiagramContent::m_element_texts, DiagramContent::m_elements, m_elmt_text_hash, m_grp_texts_hash, m_link_hash, m_removed_contents, and Diagram::showMe().
Keep the parent group of each deleted element text item.
Definition at line 51 of file deleteqgraphicsitemcommand.h.
Referenced by setPotentialsOfRemovedElements().
|
private |
Definition at line 47 of file deleteqgraphicsitemcommand.h.
Referenced by DeleteQGraphicsItemCommand(), redo(), undo(), and ~DeleteQGraphicsItemCommand().
|
private |
keep linked element for each removed element linked to other element.
Definition at line 49 of file deleteqgraphicsitemcommand.h.
Referenced by DeleteQGraphicsItemCommand(), and undo().
|
private |
Keep the parent element of each deleted dynamic element text item.
Definition at line 50 of file deleteqgraphicsitemcommand.h.
Referenced by DeleteQGraphicsItemCommand(), and undo().
Definition at line 48 of file deleteqgraphicsitemcommand.h.
|
private |
Definition at line 46 of file deleteqgraphicsitemcommand.h.
Referenced by DeleteQGraphicsItemCommand(), redo(), setPotentialsOfRemovedElements(), terminalInSamePotential(), undo(), and ~DeleteQGraphicsItemCommand().