mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-09-28 04:54:13 +02:00
8ab4e24b61
RotateTextsCommand called QDialog::exec() from inside its constructor, so the command could not be built without a human answering a dialog. That made it untestable headlessly, undrivable from any script or test harness, and it is why bugtracker #312 (PR #707) shipped with its save/reload round-trip unverified -- the symptom could not be reproduced without a GUI. The command now takes the angle as a parameter and does no asking. Two statics carry the interactive half: hasSelectedTexts(diagram) -- is there anything to rotate askRotation(rotation) -- open the dialog, false if cancelled The single call site in QETDiagramEditor asks first, then builds the command, so the user-visible behaviour is unchanged: same dialog, same title, same no-dialog-on-empty-selection. Keeping askRotation() in this class also keeps the QObject tr() context, so existing translations of "Orienter les textes sélectionnés" are not invalidated. Also guards undo()/redo() against a null m_anim_group. When nothing is selected the constructor calls setObsolete(true) without ever creating the animation group, and QUndoStack::push() calls redo() before discarding an obsolete command -- a latent null dereference on that path. Verified headlessly, which was the point: driving the command through a scratch --test-ops op on examples/741.qet (67 conductors), rotation attributes written on save go 0 -> 67 with the #707 fix present and stay at 0 with it reverted, while the reverted build instead writes userx on all 67. That is bugtracker #312 reproduced and fixed under test for the first time.