Stop reporting wires as excluded that the list is now showing

excludedConductorCount() counted conductors whose terminals had no uuid,
which was the right rule when that was the reason they were dropped. It no
longer is: Terminal::stableUuid() derives an identity from the terminal's
geometry, so those conductors are in the table.

Left unchanged, the dialog would have told the user "671 conductors excluded"
on industrial.qet while listing all 671 of them -- a worse failure than the
one the count exists to prevent, because it undermines a list that is now
correct.

The count and the dialog's explanation both now describe the case that
actually remains: an endpoint attached to no element at all, which has no
identity to key on under any scheme.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
ispyisail
2026-08-21 20:47:07 +12:00
parent e19d60ae55
commit a48124a27a
2 changed files with 19 additions and 14 deletions
+13 -8
View File
@@ -113,14 +113,17 @@ QSqlQuery projectDataBase::newQuery(const QString &query) {
/**
@brief projectDataBase::excludedConductorCount
@return how many conductors of the project are deliberately absent from
the conductor table because at least one of their terminals has no uuid.
@return how many conductors of the project are absent from the conductor
table because an endpoint has no parent element to key on.
Counted from the live scene rather than from the database, precisely
because the database is where these conductors are *not*. See
addConductor() for why they are omitted: a terminal uuid comes from the
catalog .elmt definition, so an element whose definition predates that
field yields terminals with no stable identity to key on.
because the database is where these conductors are *not*.
This used to count conductors whose terminals had no uuid, which was most
of them on most projects. Terminal::stableUuid() now derives an identity
from the terminal's geometry when the definition provides no uuid, so that
is no longer a reason to exclude anything, and this counts only the case
that remains genuinely unkeyable.
This is what lets a caller tell the user "N wires are missing and here
is why", instead of silently presenting a short list as if it were
@@ -138,8 +141,10 @@ int projectDataBase::excludedConductorCount() const
const auto conductor_list = diagram->conductors();
for (auto *conductor : conductor_list)
{
if (conductor->terminal1->uuid().isNull()
|| conductor->terminal2->uuid().isNull()) {
//Must match addConductor()'s guard exactly, or this reports
//wires as missing that the list is in fact showing.
if (!conductor->terminal1->parentElement()
|| !conductor->terminal2->parentElement()) {
++count;
}
}
+6 -6
View File
@@ -77,14 +77,14 @@ WiringListDialog::WiringListDialog(QETProject *project, QWidget *parent) :
summary->setWordWrap(true);
if (excluded > 0)
{
//The count matters more than it looks: a project whose elements
//all predate terminal uuids yields an entirely empty list, and
//without this line that is indistinguishable from a project with
//no wires in it.
//Rare now that Terminal::stableUuid() gives every terminal an
//identity: what is left is a conductor whose endpoint has no
//parent element at all. Still worth saying out loud rather than
//presenting a short list as if it were complete.
summary->setText(tr("%n conducteur(s) listé(s).", "wiring list summary", listed)
% QStringLiteral(" ")
% tr("%n conducteur(s) exclu(s) : leurs éléments ne définissent pas"
" d'identifiant de borne (définition d'élément trop ancienne).",
% tr("%n conducteur(s) exclu(s) : une extrémité n'est rattachée"
" à aucun élément.",
"wiring list exclusion warning", excluded));
}
else {