37 m_removed_contents(content),
95 QList<Terminal *> terminals_list;
97 if (t->conductors().size() >= 2) {
98 terminals_list.append(t);
101 if (terminals_list.isEmpty()) {
109 QList<Terminal *> terminals_to_connect_list;
113 Terminal *other_terminal = c->terminal1 == t ? c->terminal2 : c->terminal1;
118 if (other_terminal ==
nullptr) {
123 terminals_to_connect_list.append(other_terminal);
124 if (hub_terminal ==
nullptr) {
125 hub_terminal = other_terminal;
128 else if (other_terminal->scenePos().x() < hub_terminal->scenePos().x()) {
129 hub_terminal = other_terminal;
131 else if (other_terminal->scenePos().x() == hub_terminal->scenePos().x()) {
132 if (other_terminal->scenePos().y() < hub_terminal->scenePos().y()) {
133 hub_terminal = other_terminal;
138 terminals_to_connect_list.removeAll(hub_terminal);
139 if (hub_terminal ==
nullptr || terminals_to_connect_list.isEmpty()) {
144 for (
Terminal *t : terminals_to_connect_list)
151 if (pair.first == hub_terminal && pair.second == t) {
154 }
else if (pair.first == t && pair.second == hub_terminal) {
183 QList<Conductor *> conductor_list = terminal->
conductors();
184 conductor_list.removeAll(conductor_to_exclude);
187 Terminal *other_terminal = c->terminal1 == terminal ? c->terminal2 : c->terminal1;
189 return other_terminal;
195 Terminal *other_terminal = c->terminal1 == terminal ? c->terminal2 : c->terminal1;
197 if (terminal_to_return !=
nullptr) {
198 return terminal_to_return;
219 e->linkToElement(elmt);
233 QUndoCommand::undo();
250 if (
m_diagram -> defaultConductorProperties.m_one_text_per_folio && c -> textItem() -> isVisible())
252 QList <Conductor *> conductor_list;
253 conductor_list << c -> relatedPotentialConductors(
false).toList();
254 if (conductor_list.count())
255 conductor_list.first() -> calculateTextItemPosition();
272 deti->setParentItem(
nullptr);
279 QUndoCommand::redo();
ElementTextItemGroup * parentGroup() const
DynamicElementTextItem::parentGroup.
QList< Conductor * > conductors() const
QList< Element * > linkedElements()
Element::linkedElements.
The DynamicElementTextItem class This class provide a simple text field of element who can be added o...
QString sentence(int=All) const
DiagramContent::sentence.
void release(QGraphicsItem *)
void undo() override
DeleteQGraphicsItemCommand::undo Undo this command.
The AddItemCommand class This command add an item in a diagram The item to add is template...
void setProperties(const ConductorProperties &property)
Element * parentElement() const
QList< QGraphicsItem * > items(int=All) const
DiagramContent::items.
QList< Terminal * > terminals() const
Element::terminals.
virtual void removeItem(QGraphicsItem *item)
Diagram::removeItem Réimplemented from QGraphicsScene::removeItem(QGraphicsItem *item) Do some specif...
QList< QPair< Terminal *, Terminal * > > m_connected_terminals
Keep the parent group of each deleted element text item.
Diagram * diagram() const
void addDynamicTextItem(DynamicElementTextItem *deti=nullptr)
Element::addDynamiqueTextItem Add as a dynamic text item of this element, is reparented to this If ...
void removeDynamicTextItem(DynamicElementTextItem *deti)
Element::removeDynamicTextItem Remove , no matter if is a child of this element or a child of a group...
DiagramContent m_removed_contents
bool removeTextFromGroup(DynamicElementTextItem *text, ElementTextItemGroup *group)
Element::removeTextFromGroup Remove the text from the group , en reparent to this element...
QHash< Element *, QList< Element * > > m_link_hash
QSet< DynamicElementTextItem * > m_element_texts
QGIManager & qgiManager()
Element * parentElement() const
DynamicElementTextItem::ParentElement.
The ElementTextItemGroup class This class represent a group of element text Texts in the group can be...
QList< Element * > m_elements
QHash< DynamicElementTextItem *, ElementTextItemGroup * > m_grp_texts_hash
Keep the parent element of each deleted dynamic element text item.
Element * parentElement() const
ElementTextItemGroup::parentElement.
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...
~DeleteQGraphicsItemCommand() override
void redo() override
DeleteQGraphicsItemCommand::redo Redo the delete command.
The RemoveTextsGroupCommand class Manage the removinf of a texts group.
virtual void addItem(QGraphicsItem *item)
Diagram::addItem Réimplemented from QGraphicsScene::addItem(QGraphicsItem *item) Do some specific ope...
QList< Conductor * > conductors(int=AnyConductor) const
DiagramContent::conductors.
void manage(QGraphicsItem *)
bool addTextToGroup(DynamicElementTextItem *text, ElementTextItemGroup *group)
Element::addTextToGroup Add the text to the group ; If isn't owned by this element return false...
DeleteQGraphicsItemCommand(Diagram *diagram, const DiagramContent &content, QUndoCommand *parent=nullptr)
DeleteQGraphicsItemCommand::DeleteQGraphicsItemCommand.
QSet< ElementTextItemGroup * > m_texts_groups
Terminal * terminalInSamePotential(Terminal *terminal, Conductor *conductor_to_exclude)
DeleteQGraphicsItemCommand::terminalInSamePotential Return a terminal at the same potential of ...