mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-09-29 22:24:13 +02:00
81449faffd
Adds two QetGraphicsHandlerItem grip handles at the left/right edges of a selected DynamicElementTextItem's frameRect(), reusing the exact same handle class, scene-event-filter wiring, and live-drag-then-undo-on-release pattern QetShapeItem already uses for its own diagram-level resize handles (sources/qetgraphicsitem/qetshapeitem.cpp). - Handles are created/destroyed on ItemSelectedHasChanged, matching QetShapeItem's convention (and ElementPrimitiveDecorator's, for the element editor's own primitives). - Position is recomputed in paint() rather than hooked to specific mutators, since textWidth/font/text/rotation can all move frameRect() and there's no single itemChange notification that covers all of them. - The drag delta is resolved through mapFromScene() into the item's own local coordinates, so a rotated text box still resizes along its own baseline rather than along the scene's x-axis. - setTextWidth() is called live during the drag for immediate visual feedback (matching how QetShapeItem's handlerMouseMoveEvent live-updates geometry); only on release is a QPropertyUndoCommand pushed -- the exact same command the properties-panel width spinbox already uses (sources/ui/dynamicelementtextmodel.cpp), so no new undo-command class or XML was needed. - The original textWidth() value is preserved as-is (including -1, the "auto" sentinel) for the undo command's old_value, separately from the concrete baseline used for the live drag's delta math -- otherwise an undo would replace "auto width" with a synthesized fixed width instead of actually restoring the auto-sizing state. Scoped to DynamicElementTextItem per the discussion's phase 1 (the buildable, no-new-XML piece); IndependentTextItem and the element editor's PartText/PartDynamicTextField have no serialized width property to resize yet and are left as explicitly out-of-scope follow-ups. Verified headlessly (Xvfb + xdotool + scrot): selecting an element's label text shows the two handles, dragging one live-resizes the text (confirmed via the properties panel's width field updating in real time), and undo/redo correctly restores the exact original width including the auto-width (-1) case.