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:
ispyisail
2026-10-19 15:07:03 +13:00
committed by GitHub
4 changed files with 88 additions and 5 deletions
+12 -5
View File
@@ -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)) {