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
+8 -3
View File
@@ -408,10 +408,12 @@ int exportCsv(QETProject &project, const QString &format, const QString &output)
/// Bill of materials from the same project database and default query as the
/// GUI nomenclature export.
int exportBom(QETProject &project, const QString &output)
int exportBom(QETProject &project, const QString &output,
bool includeSlaves, bool includeJunctions)
{
project.dataBase()->updateDB();
QSqlQuery query = project.dataBase()->newQuery(BomExport::defaultQuery());
QSqlQuery query = project.dataBase()->newQuery(
BomExport::defaultQuery(includeSlaves, includeJunctions));
if (!query.exec()) {
err << "BOM query failed: " << query.lastError().text() << "\n";
return 1;
@@ -980,6 +982,9 @@ int run(const QStringList &args)
// collected below.
QStringList filtered = args;
const bool showTerminals = filtered.removeAll("--show-terminals") > 0;
// --no-slaves and --no-junctions leave rows out of --export-bom.
const bool includeSlaves = filtered.removeAll("--no-slaves") == 0;
const bool includeJunctions = filtered.removeAll("--no-junctions") == 0;
QString flag;
QStringList rest;
@@ -1037,7 +1042,7 @@ int run(const QStringList &args)
if (format == "cables" || format == "wires")
return exportCsv(project, format, output);
if (format == "bom")
return exportBom(project, output);
return exportBom(project, output, includeSlaves, includeJunctions);
if (format == "wiring")
return exportWiring(project, output);
if (format == "nets")