Add options to leave junctions and contact blocks out of the parts list (#1178)

Since #849 the parts list has a row for every contact block (slave) and
terminal-type element. Users who draw the dots and bends where wires
branch as terminal-type symbols (114_connections) get one empty row per
junction: 109 of 151 rows on one reported cabinet.

Two options, both off by default so existing exports are unchanged:
- leave out the contact blocks: --no-slaves, "no_slaves" in qet_export,
  or uncheck the new "Contacts esclaves" element type in the dialog;
- leave out the junctions: terminal-type elements with no label,
  designation, manufacturer or manufacturer reference. --no-junctions,
  "no_junctions", or "Laisser de côté les jonctions" in the dialog.
  A terminal block with a label or a part number stays.

The element type filter had no box for slaves, so every query it built
left them out: the export dialog never listed contact blocks, although
the command line has since #849. The dialog now checks the new box by
default and gives the same rows as --export-bom. The box is unchecked by
default elsewhere, so nomenclature tables keep their rows.

docs/smart-device-bom.md still said slaves and terminals were excluded;
corrected.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
ispyisail
2026-10-05 22:08:44 +13:00
parent 32f7b94594
commit 8434b88eb8
17 changed files with 273 additions and 39 deletions
+28
View File
@@ -120,6 +120,34 @@ void SmartDeviceTest::defaultQueryAndCsv()
QVERIFY(csv.contains("Terminal block"));
QVERIFY(!csv.contains("Must not be exported"));
QVERIFY(csv.indexOf("-K1") < csv.indexOf("-K2"));
//#1178: a junction -- a terminal-type symbol drawn where wires
//branch -- has no label and no part data. It can be left out, and
//so can the contact blocks; a terminal block with only a part
//number stays.
QSqlQuery raw(db);
QVERIFY(raw.exec(QStringLiteral(
"INSERT INTO element_nomenclature_view "
"(label, element_type, diagram_position, position) "
"VALUES (NULL, 'terminal', 1, 6)")));
QVERIFY(raw.exec(QStringLiteral(
"INSERT INTO element_nomenclature_view "
"(label, designation, manufacturer, manufacturer_reference, "
"element_type, diagram_position, position) "
"VALUES ('', '', '', 'PT 2,5', 'terminal', 1, 7)")));
auto count = [&db](const QString &sql) {
QSqlQuery q(db);
if (!q.exec(sql))
return -1;
int n = 0;
while (q.next())
++n;
return n;
};
QCOMPARE(count(BomExport::defaultQuery()), 6);
QCOMPARE(count(BomExport::defaultQuery(true, false)), 5);
QCOMPARE(count(BomExport::defaultQuery(false, true)), 5);
QCOMPARE(count(BomExport::defaultQuery(false, false)), 4);
}
QSqlDatabase::removeDatabase(connection);
}