mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-08-22 08:34:12 +02:00
bc79a5df7a
Three fixes to the tables added by this slice. A conductor's text was written once at insert and never again. Renaming a wire left the database holding the old number, so the wiring list showed a stale value until the next full repopulate -- elements have elementInfoChanged() for exactly this and conductors had nothing. Conductor::setProperties() has around a dozen call sites (auto-numbering, the properties dialog, element moves, the delete command's re-links), so rather than adding a call to each and missing the ones added later, listen to the propertiesChange() signal it already emits. Qt::UniqueConnection means a repeated insert or a full repopulate cannot double-subscribe, and the connection is established on both insert paths because conductors read from a file never pass through addConductor(). addConductor() and populateConductorTable() each carried their own copy of the same seven bindValue() lines. They had not drifted yet, but that is the same duplication the element paths had before bindElementValues(), where they had drifted -- one binding kindInformations()["type"] and the other masterTypeToString(). One bindConductorValues() for both. Finally, index the conductor columns that get looked up per element rather than per conductor. element_nomenclature_view counts the wires touching each element with a correlated subquery, so without an index every element row full-scans the conductor table and the cost grows as elements x conductors. Measured on a standalone SQLite harness at 2000 elements x 5000 conductors: 2134 ms unindexed, 10 ms indexed. diagram_uuid is indexed too, since the wiring list view joins on it. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>