mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-10-21 13:54:13 +02:00
Merge pull request #1545 from ispyisail/refactor/save-links-from-db
Fix removed folios leaving links to their symbols in the saved file
This commit is contained in:
@@ -1438,12 +1438,19 @@ QDomElement Element::toXml(
|
||||
QDomElement inputs = document.createElement(QStringLiteral("inputs"));
|
||||
element.appendChild(inputs);
|
||||
|
||||
//if this element is linked to other elements,
|
||||
//save the uuid of each other elements (linksToSave())
|
||||
//if this element is linked to other elements, save the uuid of each:
|
||||
//as the project database's link rows list them (QETZ-DB-FIRST stage
|
||||
//2a), or, for a symbol the database does not hold, as it lists them
|
||||
//itself (linksToSave())
|
||||
QList<std::pair<QUuid, int>> links;
|
||||
for (const SavedLink &link : linksToSave(diagram() && diagram()->project()
|
||||
? diagram()->project()->waitingLinkTargets() : QSet<QUuid>()))
|
||||
links.append({link.uuid, link.group_index});
|
||||
projectDataBase *database = diagram() && diagram()->project()
|
||||
? diagram()->project()->dataBase() : nullptr;
|
||||
if (!database || !database->savedLinks(this, &links)) {
|
||||
links.clear();
|
||||
for (const SavedLink &link : linksToSave(diagram() && diagram()->project()
|
||||
? diagram()->project()->waitingLinkTargets() : QSet<QUuid>()))
|
||||
links.append({link.uuid, link.group_index});
|
||||
}
|
||||
if (!links.isEmpty()) {
|
||||
QDomElement links_uuids = document.createElement(QStringLiteral("links_uuids"));
|
||||
for (const auto &link : std::as_const(links)) {
|
||||
|
||||
Reference in New Issue
Block a user