QElectroTech
0.70
|
The LinkElementCommand class This undo class manage link between elements. In the same instance of this class, we can link and unlink elements from an edited element This undo class support the merge. More...
#include <linkelementcommand.h>
Public Member Functions | |
LinkElementCommand (Element *element_, QUndoCommand *parent=nullptr) | |
LinkElementCommand::LinkElementCommand Constructor. More... | |
int | id () const override |
bool | mergeWith (const QUndoCommand *other) override |
LinkElementCommand::mergeWith. More... | |
void | setLink (const QList< Element *> &element_list) |
LinkElementCommand::setLink Replace all linked elements of edited element by elements stored in This method do several check to know if element can be linked or not. More... | |
void | setLink (Element *element_) |
LinkElementCommand::setLink This is an overloaded function. More... | |
void | unlink (QList< Element *> element_list) |
LinkElementCommand::unlink Unlink all elements of element_list from the edited element. More... | |
void | unlinkAll () |
LinkElementCommand::unlinkAll Unlink all element of the edited element. More... | |
void | undo () override |
LinkElementCommand::undo Undo this command. More... | |
void | redo () override |
LinkElementCommand::redo Redo this command. More... | |
Static Public Member Functions | |
static bool | isLinkable (Element *element_a, Element *element_b, bool already_linked=false) |
LinkElementCommand::isLinkable. More... | |
Private Member Functions | |
void | setUpNewLink (const QList< Element *> &element_list, bool already_link) |
LinkElementCommand::setUpNewLink Update the content of m_link_after with the content of . Each linkable element (know via the static method isLinkable) is added to m_linked_after is used for the static method isLinkable. More... | |
void | makeLink (const QList< Element *> &element_list) |
LinkElementCommand::makeLink Make the link between m_element and element_list; This method unlink elements if needed. More... | |
Private Attributes | |
Element * | m_element |
bool | m_first_redo |
QList< Element * > | m_linked_before |
QList< Element * > | m_linked_after |
The LinkElementCommand class This undo class manage link between elements. In the same instance of this class, we can link and unlink elements from an edited element This undo class support the merge.
Definition at line 31 of file linkelementcommand.h.
LinkElementCommand::LinkElementCommand | ( | Element * | element_, |
QUndoCommand * | parent = nullptr |
||
) |
LinkElementCommand::LinkElementCommand Constructor.
element_ | : element where we work the link / unlink |
parent | : parent undo |
Definition at line 31 of file linkelementcommand.cpp.
References Element::linkedElements(), m_element, m_linked_after, m_linked_before, and QET::Icons::tr.
|
inlineoverride |
Definition at line 36 of file linkelementcommand.h.
|
static |
LinkElementCommand::isLinkable.
element_a | |
element_b | |
already_linked |
Definition at line 66 of file linkelementcommand.cpp.
References Element::isFree(), Element::linkedElements(), Element::linkType(), Element::Master, Element::NextReport, Element::PreviousReport, Element::Simple, Element::Slave, and Element::Terminale.
Referenced by setUpNewLink().
|
private |
LinkElementCommand::makeLink Make the link between m_element and element_list; This method unlink elements if needed.
element_list |
Definition at line 258 of file linkelementcommand.cpp.
References Element::linkedElements(), Element::linkToElement(), m_element, Element::unlinkAllElements(), and Element::unlinkElement().
|
override |
LinkElementCommand::mergeWith.
other | try to merge this command with other |
Definition at line 45 of file linkelementcommand.cpp.
References m_element, m_linked_after, and undo().
|
override |
LinkElementCommand::redo Redo this command.
Definition at line 184 of file linkelementcommand.cpp.
References Element::AllReport, Element::conductors(), QetGraphicsItem::diagram(), QET::eachStrIsEqual(), Element::linkType(), m_element, m_first_redo, m_linked_after, makeLink(), and Diagram::showMe().
void LinkElementCommand::setLink | ( | const QList< Element *> & | element_list | ) |
LinkElementCommand::setLink Replace all linked elements of edited element by elements stored in This method do several check to know if element can be linked or not.
element_list |
Definition at line 132 of file linkelementcommand.cpp.
References m_linked_after, and setUpNewLink().
Referenced by LinkSingleElementWidget::associatedUndo(), MasterPropertiesWidget::associatedUndo(), and setLink().
void LinkElementCommand::setLink | ( | Element * | element_ | ) |
LinkElementCommand::setLink This is an overloaded function.
element_ |
Definition at line 143 of file linkelementcommand.cpp.
References setLink().
|
private |
LinkElementCommand::setUpNewLink Update the content of m_link_after with the content of . Each linkable element (know via the static method isLinkable) is added to m_linked_after is used for the static method isLinkable.
element_list | |
already_link |
Definition at line 229 of file linkelementcommand.cpp.
References isLinkable(), Element::linkType(), m_element, m_linked_after, and Element::Master.
Referenced by setLink().
|
override |
LinkElementCommand::undo Undo this command.
Definition at line 173 of file linkelementcommand.cpp.
References QetGraphicsItem::diagram(), m_element, m_linked_before, makeLink(), and Diagram::showMe().
Referenced by mergeWith().
void LinkElementCommand::unlink | ( | QList< Element *> | element_list | ) |
LinkElementCommand::unlink Unlink all elements of element_list from the edited element.
element_list |
Definition at line 155 of file linkelementcommand.cpp.
References m_linked_after.
void LinkElementCommand::unlinkAll | ( | ) |
LinkElementCommand::unlinkAll Unlink all element of the edited element.
Definition at line 165 of file linkelementcommand.cpp.
References m_linked_after.
Referenced by LinkSingleElementWidget::associatedUndo(), and MasterPropertiesWidget::associatedUndo().
|
private |
Definition at line 54 of file linkelementcommand.h.
Referenced by LinkElementCommand(), makeLink(), mergeWith(), redo(), setUpNewLink(), and undo().
|
private |
Definition at line 55 of file linkelementcommand.h.
Referenced by redo().
|
private |
Definition at line 57 of file linkelementcommand.h.
Referenced by LinkElementCommand(), mergeWith(), redo(), setLink(), setUpNewLink(), unlink(), and unlinkAll().
|
private |
Definition at line 56 of file linkelementcommand.h.
Referenced by LinkElementCommand(), and undo().