mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-10-02 16:44:16 +02:00
23f8e261e5
Moving the PLC table in the element editor was lost on save: the table came back at (0, 0) when the element was reopened, and it was drawn at (0, 0) in the diagram editor as well. PartPlcTable::toXml() wrote m_rect.x()/y(), which are the coordinates inside the item, and the move of a part never touches m_rect - it lives in pos() (CustomElementGraphicPart::mouseMoveEvent, or the decorator for a multi-selection). m_rect starts at the item origin, so x="0" y="0" was written whatever the user did, while fromXml() reads those two attributes as scene coordinates and hands them to setPos(). Every other part translates first, see PartRectangle::toXml() with sceneTopLeft(). The top-left corner is now mapped to scene coordinates before being written, which also covers a group transformation, since that one moves m_rect while pos() stays put. Both readers of the attribute need no change: ElementScene::fromXml() for the editor and Element() for the runtime drawing of the table (Element::drawPlcTable) already expect scene coordinates. Elements that still carry x="0" y="0" keep loading as before. Full build clean. Test suite: the same three failures as before the change (tst_menubarkeyboard, tst_databasefromdocument, tst_terminaluuids), each of them also failing on a build without this patch, so they are unrelated.