mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-10-19 20:44:16 +02:00
68914ee31b
A report's texts that show a wire's properties (function, section...) are only filled once the wires are read, and those are read after the symbols: the fill comes from the 100 ms timer of DynamicElementTextItem::conductorWasAdded(), by which time the project state is Ok again and the alignment is live. For a report whose partner is linked, that fill had already happened inside the loading state (Element::initLink() -> linkedElementChanged() -> reportChanged()), so the alignment was blocked and the text stayed where the file put it. buildFolios() relies on that and says so. An unlinked report, and one whose partner sits on a folio not built yet, got nothing during loading: the first fill was the timer's one. It took the rect of the still empty text for anchor and shifted the item by the whole width of the text, on every open. Only the right, centred or bottom aligned texts showed it -- the others have a null offset. Fill those texts inside the loading state instead. Element:: updateConductorTexts(), already run when a wire is connected to a terminal, now covers a report as well as a wire label, and Diagram::refreshContents() runs it for every symbol while the project is still parsing, right after initLink() has resolved the links. The timer's fill that comes 100 ms later then finds the text already set, and DynamicElementTextItem::setPlainText() returns on it unchanged, so the alignment is never handed an empty rect to anchor. A wire that appears, or a property that changes, while the project is open is aligned as it was. A report's "label" text is left to updateReportText(): it is the linked folio's, not the symbol's own information.