Skip to content

Refactor drag and drop system#227

Closed
Copilot wants to merge 1 commit intomasterfrom
copilot/refactor-drag-and-drop-system
Closed

Refactor drag and drop system#227
Copilot wants to merge 1 commit intomasterfrom
copilot/refactor-drag-and-drop-system

Conversation

Copy link
Copy Markdown

Copilot AI commented Apr 9, 2026

Summary

Addresses the indirection, split implementations, and general annoyances in the drag-and-drop / resize system.

Problem

The old code attached grid geometry functions (validSpot, validResize, getPoint, getRect, resetValid) and the currentOpValid state directly to the Repeater element (id: grid). This caused several problems:

  • A Repeater is a view component; using it as a calculation engine was confusing.
  • BaseWidget.qml and ResizeComponent.qml both accessed the Repeater by its id (grid) from inside delegate components — the coupling was invisible without knowing the exact scope chain.
  • ResizeComponent.qml also used bare model role names (row, column, rowSpan, colSpan) that are only accessible as implicit delegate scope properties, making data flow hard to trace.

Changes

Tab.qml

  • Moved all grid logic functions (validSpot, validResize, getPoint, getRect, resetValid) and lastOpSuccessful state from the Repeater to Tab itself.
  • Renamed the Repeater id from grid to widgetRepeater (it now only renders widgets — no logic attached).

BaseWidget.qml

  • Replaced every grid.* call with tab.*.
  • Replaced implicit delegate model-role accesses (row, column, rowSpan, colSpan) with explicit model.row, model.column, model.rowSpan, model.colSpan.

ResizeComponent.qml

  • Replaced every grid.* call with tab.*.
  • Replaced bare row/column/rowSpan/colSpan delegate-scope accesses with explicit widget.mrow/widget.mcolumn/widget.mrowSpan/widget.mcolumnSpan.

docs/drag-drop-architecture.md (new)

  • Documents component responsibilities, key properties/functions, and data-flow diagrams for all three drag scenarios (in-grid drag, from-sidebar drag, resize).

Testing

No automated tests exist for this area; the logic is QML/UI-level. The refactoring is a pure rename/move — no algorithms were changed, only where the functions live and how they are referenced.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants