mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-10-04 18:04:14 +02:00
Merge pull request #1270 from ispyisail/fix/script-delete-element-wires
Fix qet.deleteElement() leaving the symbol's wires in the project
This commit is contained in:
@@ -772,6 +772,16 @@ bool QetScriptApi::deleteElement(int folioIndex, const QString &elementUuid)
|
||||
|
||||
DiagramContent content;
|
||||
content.m_elements << element;
|
||||
// The wires on its terminals go with it, as when the Delete key
|
||||
// removes a selected element (DiagramContent puts them in
|
||||
// m_conductors_to_update); without them they stay on the folio,
|
||||
// attached to an element that is no longer there.
|
||||
for (Terminal *terminal : element->terminals()) {
|
||||
for (Conductor *conductor : terminal->conductors()) {
|
||||
if (!content.m_conductors_to_update.contains(conductor))
|
||||
content.m_conductors_to_update << conductor;
|
||||
}
|
||||
}
|
||||
if (DeleteQGraphicsItemCommand::hasNonDeletableTerminal(content)) {
|
||||
log(QStringLiteral("qet.deleteElement: %1 has a non-deletable terminal (linked master/slave?), refusing").arg(elementUuid));
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user