mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-08-14 18:44:13 +02:00
2e1ba46430
Cross-references were missing from DXF exports, as reported on the forum: https://qelectrotech.org/forum/viewtopic.php?id=2481 generateDxf() walks the scene and collects items by cast. A slave element's cross-reference label ("(6-G15)", pointing back to its master) is a plain QGraphicsTextItem hung off a DynamicElementTextItem as a child, so it matches neither the IndependentTextItem nor the DynamicElementTextItem branch and was dropped on the floor. Nothing was wrong with the label itself; it was simply never collected. Collect it through the existing DynamicElementTextItem::slaveXrefItem() accessor and draw it with the same placement, rotation and multi-line handling as the other text items, using defaultTextColor() since a bare QGraphicsTextItem has no DiagramTextItem::color(). Measured on examples/industrial.qet, comparing against the PDF export (which renders the whole scene and so shows everything): before after PDF slave xrefs "(n-Xn)" 0 41 41 folio/position strings 317 358 403 The slave cross-references now match the PDF exactly. Still missing, and not addressed here: the master-side cross-reference table drawn by CrossRefItem, which accounts for the remaining 45 strings. CrossRefItem is a QGraphicsObject that renders itself with custom QPainter code in three different modes (drawAsCross, drawAsContacts, drawAsPlcTable) including contact symbols and rules, so giving it a DXF representation is a larger piece of work than this.