mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-09-29 22:24:13 +02:00
Scripting: look up a table or a symbol text field by its uuid
qet.textIndex(), shapeIndex() and imageIndex() turn a free text's, shape's or picture's uuid into the index the other calls take. Tables and symbol text fields had no such lookup, so a script could only name them by index, and an index shifts when an earlier item is deleted: a script that deletes table 0 and then moves "table 1" moves the wrong table. - qet.tableIndex(folio, uuid): the table's current index in tables(folio), or -1. - qet.elementTextIndex(folio, elementUuid, textUuid): the field's current index in elementTexts(folio, elementUuid), or -1. The element is part of the address because a field's uuid is unique only within its element: copying an element keeps its fields' uuids (2612_ats_singlephase.qet has one field uuid on 20 copies). Tests in misc/qet-mcp's integration suite, which drives these through --run: a table followed across a deletion of the one before it, and the same field uuid resolving on two copies to each copy's own field. Both fail against a build without this change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -483,6 +483,7 @@ class QetScriptApi : public QObject
|
||||
|
||||
// -- a BOM/nomenclature or summary table placed on a folio --
|
||||
Q_INVOKABLE QStringList tables(int folioIndex) const;
|
||||
Q_INVOKABLE int tableIndex(int folioIndex, const QString &uuid) const;
|
||||
Q_INVOKABLE int addTable(int folioIndex, const QString &kind, const QString &name,
|
||||
const QString &query);
|
||||
Q_INVOKABLE bool deleteTable(int folioIndex, int tableIndex);
|
||||
@@ -508,6 +509,8 @@ class QetScriptApi : public QObject
|
||||
|
||||
// -- the text fields shown on a symbol (label, terminal names, ...) --
|
||||
Q_INVOKABLE QStringList elementTexts(int folioIndex, const QString &elementUuid) const;
|
||||
Q_INVOKABLE int elementTextIndex(int folioIndex, const QString &elementUuid,
|
||||
const QString &textUuid) const;
|
||||
Q_INVOKABLE int addElementText(int folioIndex, const QString &elementUuid,
|
||||
const QString &source, const QString &value,
|
||||
double x, double y);
|
||||
|
||||
Reference in New Issue
Block a user