Skip to content

map_tree_view: InternalMove drag-drop mode to restore layer reordering (closes #81)#83

Merged
rolker merged 2 commits into
jazzyfrom
feature/issue-81
Jun 9, 2026
Merged

map_tree_view: InternalMove drag-drop mode to restore layer reordering (closes #81)#83
rolker merged 2 commits into
jazzyfrom
feature/issue-81

Conversation

@rolker

@rolker rolker commented Jun 9, 2026

Copy link
Copy Markdown
Owner

Summary

Restores Layers-tab drag-to-reorder, which stopped working after the #59 camp2 layer-system port.

MapTreeView set setDragEnabled(true) + viewport()->setAcceptDrops(true) but left the view in
the default (non-InternalMove) drag-drop mode. In that mode, after a MoveAction drop the view
runs its own clearOrRemove() on the (now-stale) source rows — on top of Map::dropMimeData()
having already performed the move (beginRemoveRows + setParentItem + stackBefore +
beginInsertRows). That double-handling leaves the reorder not taking.

Switching to QAbstractItemView::InternalMove configures dragEnabled + acceptDrops and makes
the view trust dropMimeData() to perform the whole move (no clearOrRemove), restricted to
internal moves — exactly layer reordering.

Why it matters

Reordering restacks rendering via stackBefore, so this is also the manual operator workaround for
overlays (footprint, collision zones) being hidden behind the costmap (#80) until a deliberate
Z-order convention lands.

Testing

  • Built camp clean in the worktree.
  • Verified in the simulator (BEN): dragging layers in the Layers tab now reorders them and restacks
    rendering correctly.

Closes #81. Related: #80 (layer Z-order/stacking), #82 (chart-layer dedup).


Authored-By: Claude Code Agent
Model: Claude Opus 4.8 (1M context)

Claude Code Agent added 2 commits June 9, 2026 11:28
The Layers-tab drag-to-reorder stopped working after the #59 camp2 layer
port. MapTreeView set dragEnabled + viewport acceptDrops but left the view
in the default (non-InternalMove) drag-drop mode. In that mode, after a
MoveAction drop the view runs its own clearOrRemove() on the (now-stale)
source rows on top of Map::dropMimeData() having already performed the
move (beginRemoveRows + setParentItem + stackBefore + beginInsertRows) —
double-handling that leaves the reorder not taking.

Switch to QAbstractItemView::InternalMove, which configures dragEnabled +
acceptDrops and makes the view trust dropMimeData() to perform the whole
move (no clearOrRemove), restricted to internal moves — exactly layer
reordering. Reordering restacks rendering via stackBefore, the manual
workaround for overlays hidden behind the costmap (#80).

Refs #81
Copilot AI review requested due to automatic review settings June 9, 2026 15:57

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Restores layer reordering in the camp2 Layers tab by correctly configuring MapTreeView for internal drag-and-drop moves, ensuring the view defers the move operation to Map::dropMimeData() (instead of performing additional source-row removal).

Changes:

  • Switch MapTreeView to QAbstractItemView::InternalMove to re-enable drag-to-reorder behavior for layers.
  • Add a code comment explaining why InternalMove is necessary for correct model-driven reordering.
  • Add an agent progress note documenting the local pre-push review for issue #81.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/camp2/map_tree_view/map_tree_view.cpp Sets drag-drop mode to InternalMove so layer reordering works via model dropMimeData() without double-handling.
.agent/work-plans/issue-81/progress.md Adds issue #81 progress/review tracking notes for the agent workflow.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@rolker rolker merged commit 6a426cd into jazzy Jun 9, 2026
1 check passed
@rolker rolker deleted the feature/issue-81 branch June 9, 2026 16:01
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.

Layers-tab drag-to-reorder no longer works (regression from #59 port)

2 participants