Add, move or remove a folio without building the others (stage D5)

Adding, moving or removing a folio rewrote every folio's position in
the project database through diagrams(), which builds every folio: 3 s
on a 50-folio project opened lazily. A folio not built has its position
and title block already, so folios() is enough. The list of tables a
table can continue builds only the folios holding a table (from the
index of a .qetz), and the wiring list's count of wires left out looks
at built folios only: reading a wire drops it unless both its ends are
found.

tst_lazyfolios: a folio added, moved and removed builds no other, with
the folios' rows as when every folio is built (fails with diagrams():
47 built); the tables listed as when built, building the 12 folios that
hold one (fails when every folio is built). ctest 96/96 eager and lazy;
342 corpus projects save the same in all four arms.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
ispyisail
2026-10-12 08:46:31 +13:00
parent 8ae937007c
commit e7fd820db6
5 changed files with 91 additions and 4 deletions
+21
View File
@@ -2978,6 +2978,27 @@ bool QETProject::usesElement(const ElementsLocation &location) const
return(unbuiltFolioElements().contains(location));
}
/**
@brief QETProject::buildFoliosHoldingTables
Build the folios not built yet (QET_LAZY_FOLIOS) that hold a drawn
table, found from the index the project was opened from when it has
one: what a list of the project's tables needs, and no more
*/
void QETProject::buildFoliosHoldingTables()
{
QList<Diagram *> to_build;
for (Diagram *d : std::as_const(m_diagrams_list))
if (!d->isLoaded() && unbuiltFolioHasTables(d))
to_build << d;
if (to_build.isEmpty()) {
return;
}
if (qEnvironmentVariableIntValue("QET_LAZY_FOLIOS_TRACE") == 1) {
qWarning().noquote() << "lazy folios:" << to_build.size() << "folios built for their tables";
}
buildFolios(to_build);
}
/**
@brief QETProject::unbuiltFolioHasTables
@return true if @p folio, not built yet (QET_LAZY_FOLIOS), has a drawn