mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-09-29 05:44:14 +02:00
95d0e523fe
Dragging an element's text -- its label, article number, any of its information fields -- moved it in free one-unit steps while everything else in the editor snapped to the grid. Reported by pki791 in #923 for labels moved with Shift. QET moves a text with the mouse along five paths. Four snap and let Ctrl place freely: DiagramTextItem::mouseMoveEvent an independent text ElementTextItemGroup::mouseMoveEvent a group of element texts ElementTextsMover::continueMovement every OTHER selected element text QetGraphicsItem::setPos elements, images, shapes DynamicElementTextItem::mouseMoveEvent, the text actually under the cursor, ended "setPos(new_pos)" with no grid and no modifier check. It is otherwise the same function as the group's, which is why this reads as an omission rather than a decision: the line this adds is that function's, character for character. The inconsistency was visible in one gesture. With two element texts selected and one of them dragged, ElementTextsMover skips the driver item and snaps the rest, so the text under the cursor was the only one on the folio that did not land on the grid. Verified on a virtual display (Xvfb + openbox) against a two-lamp fixture, grid 10, reading the saved positions rather than the screen: Shift+drag the label before (32.95, -11.55) -> (7.95, 23.45) off-grid after -> (10, 20) on-grid the co-selected label (10, -10) -> (50, 20) on-grid, before and after Shift to grab, then Ctrl -> (7.95, 23.45) off-grid, free placement kept The last line matters: moving an element text needs Shift at press, and the modifier is read at move time, so Ctrl still places freely -- press with Shift, hold Ctrl to drag. Holding both from the press is a different gesture, reserved by DiagramView::isCtrlShifting() for the view's mode switch, and does not move the text at all. Nothing that was possible before is lost. Worth knowing when reviewing: 470 of the 492 element texts in the 24 example projects (95.5 %) sit off the grid today, because element definitions place their default text at fractional offsets. The first drag of almost any existing label will pull it onto the grid, by at most half a grid step. ctest 12/12, Qt 6. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>