Add drag-and-drop reordering of layout view tabs#2395
Open
nharjee wants to merge 1 commit into
Open
Conversation
Enable QTabBar movable tabs on the main window's layout-view tab bar and keep the backing data model in sync when tabs are dragged. The tab index is used as a positional key into mp_views and the seven parallel widget stacks, so a reorder in the tab bar alone would desync them. A new MainWindow::tab_moved(from, to) slot, connected to QTabBar::tabMoved, reorders mp_views and every stack to match the new tab order and re-raises the current widgets. Since Qt emits tabMoved before currentChanged, the subsequent view selection operates on the already-reordered stacks; the current view is tracked by object (LayoutView::current), so it is never lost across a reorder. Adds a move_widget(from, to) helper to both ViewWidgetStack and ControlWidgetStack to reorder their internal widget vectors. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Collaborator
|
The PR looks okay, but let me tell you that I am absolute not in favor of AI-authored PRs. I am basically inclined to reject them unconditionally, because I don't consider them trustworthy and I don't want to accept PRs that take me more time to review than it took to create them. I think there is more to consider with respect to tab reordering. I will take a look, but with low priority. Matthias |
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
Enables drag-and-drop reordering of the layout view tabs in the main window. Previously the tabs could not be rearranged; this makes the tab bar movable and keeps the underlying view model in sync when tabs are dragged.
Details
The tab index is used as a positional key into
mp_viewsand the seven parallel widget stacks (view / layer-control / layer-toolbox / hierarchy / libraries / editor-options / bookmarks), so reordering theQTabBaralone would desync them.MainWindow: enableQTabBar::setMovable(true)and connectQTabBar::tabMoved(int,int)to a newMainWindow::tab_moved(from, to)slot that reordersmp_viewsand every widget stack to match the new tab order, then re-raises the current widgets.tabMovedbeforecurrentChanged, so any subsequent view selection operates on the already-reordered stacks.LayoutView::current()), so it is never lost across a reorder — only its index changes.ViewWidgetStackandControlWidgetStack: add amove_widget(from, to)helper that reorders the internal widget vector.Net change is additive: 6 files, +64 lines.
Testing
build4mac.py).ut_runnerviamacQAT.py) run before and after: the same pre-existing set of failures (unrelatedrba/lvs/drc/tlreference-data and environment-specific tests) appears with and without this change; no new failures are introduced.Known cosmetic note
On macOS, while a tab is actively being dragged, Qt's built-in movable-tab drag rendering tints the tabs flanking the lifted tab blue (the platform style's
dragInProgresspaint path, using a grabbed-pixmap overlay for the moving tab). This is Qt-native behavior triggered simply by enablingsetMovable(true)— it occurs before any reorder logic runs, is purely visual, and reverts on drop. Left as-is.