map_tree_view: InternalMove drag-drop mode to restore layer reordering (closes #81)#83
Merged
Conversation
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
There was a problem hiding this comment.
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
MapTreeViewtoQAbstractItemView::InternalMoveto re-enable drag-to-reorder behavior for layers. - Add a code comment explaining why
InternalMoveis 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Restores Layers-tab drag-to-reorder, which stopped working after the #59 camp2 layer-system port.
MapTreeViewsetsetDragEnabled(true)+viewport()->setAcceptDrops(true)but left the view inthe default (non-
InternalMove) drag-drop mode. In that mode, after aMoveActiondrop the viewruns its own
clearOrRemove()on the (now-stale) source rows — on top ofMap::dropMimeData()having already performed the move (
beginRemoveRows+setParentItem+stackBefore+beginInsertRows). That double-handling leaves the reorder not taking.Switching to
QAbstractItemView::InternalMoveconfiguresdragEnabled+acceptDropsand makesthe view trust
dropMimeData()to perform the whole move (noclearOrRemove), restricted tointernal moves — exactly layer reordering.
Why it matters
Reordering restacks rendering via
stackBefore, so this is also the manual operator workaround foroverlays (footprint, collision zones) being hidden behind the costmap (#80) until a deliberate
Z-order convention lands.
Testing
campclean in the worktree.rendering correctly.
Closes #81. Related: #80 (layer Z-order/stacking), #82 (chart-layer dedup).
Authored-By:
Claude Code AgentModel:
Claude Opus 4.8 (1M context)