Fix problem when really old elements are added to a new project. These elements do not have an uuid for each terminal. So when exporting, save an unique ID into the terminal. So the conductors know to which terminal they must be connected

This commit is contained in:
Martin Marmsoler
2021-03-14 11:49:01 +01:00
parent 2a4416469a
commit 539de96455
3 changed files with 37 additions and 1 deletions

View File

@@ -944,8 +944,15 @@ QDomElement Element::toXml(
QDomElement terminal = t -> toXml(document);
if (t->ID() > 0) {
// for backward compatibility
// Terminal was loaded during loading an old project. So the terminal has a valid id
terminal.setAttribute("id", t->ID()); // for backward compatibility
}
} else if (t->uuid().isNull()) {
// for backward compatibility
// An old element with no uuid on the terminals was added to the project.
// give it an id
t->setID(t->diagram()->uniqueTerminalID());
terminal.setAttribute("id", t->ID());
}
xml_terminals.appendChild(terminal);
}
element.appendChild(xml_terminals);