mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-10-15 10:04:13 +02:00
Number terminals and export wire numbers without building every folio (stage D5)
Terminal numbering builds only the folios holding a terminal. The wire numbers export reads the wires of the folios not built from the project database, and walks a built folio's own wires instead of a DiagramContent, which followed their potentials through folio reports and built the folios at the other end. The wiring list export names a folio from its title block, which a folio not built has; it still builds every folio, writing the whole project out (toXml()). tst_lazyfolios: wire numbers exported as when built, from a .qet and a .qetz, building no folio (fails with DiagramContent: 27 built); terminal numbering builds 7 folios, those with a terminal (fails with diagrams(): 47); the wiring list as when 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:
@@ -13,6 +13,16 @@
|
||||
#include <QSet>
|
||||
#include <algorithm>
|
||||
|
||||
namespace {
|
||||
//The folios holding a terminal, built: a folio not built yet
|
||||
//(QET_LAZY_FOLIOS) holding none is not built for this
|
||||
QList<Diagram *> terminalFolios(QETProject *project)
|
||||
{
|
||||
project->buildFoliosHolding(ElementData::Terminal, false);
|
||||
return project->builtFolios();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief TerminalNumberingDialog::TerminalNumberingDialog
|
||||
* Constructor
|
||||
@@ -31,7 +41,7 @@ TerminalNumberingDialog::TerminalNumberingDialog(QWidget *parent, QETProject *pr
|
||||
// Collect all unique terminal strip prefixes from the project
|
||||
if (project) {
|
||||
QSet<QString> prefixes;
|
||||
foreach (Diagram *diagram, project->diagrams()) {
|
||||
foreach (Diagram *diagram, terminalFolios(project)) {
|
||||
foreach (QGraphicsItem *qgi, diagram->items()) {
|
||||
if (Element *elmt = qgraphicsitem_cast<Element *>(qgi)) {
|
||||
if (elmt->elementData().m_type == ElementData::Terminal) {
|
||||
@@ -153,7 +163,7 @@ QUndoCommand* TerminalNumberingDialog::getUndoCommand(QETProject *project) const
|
||||
QList<TermInfo> termList;
|
||||
|
||||
// 2. Collect all terminals from all folios in the project
|
||||
foreach (Diagram *diagram, project->diagrams()) {
|
||||
foreach (Diagram *diagram, terminalFolios(project)) {
|
||||
int fIndex = diagram->folioIndex();
|
||||
foreach (QGraphicsItem *qgi, diagram->items()) {
|
||||
if (Element *elmt = qgraphicsitem_cast<Element *>(qgi)) {
|
||||
|
||||
Reference in New Issue
Block a user