Skip to content

[DockWindow V2] Stabilization. Step 2#151

Open
Eism wants to merge 2 commits into
musescore:mainfrom
Eism:kddock_v2_toolbarsresize_fix
Open

[DockWindow V2] Stabilization. Step 2#151
Eism wants to merge 2 commits into
musescore:mainfrom
Eism:kddock_v2_toolbarsresize_fix

Conversation

@Eism

@Eism Eism commented Jul 14, 2026

Copy link
Copy Markdown
Collaborator

Resolves: musescore/MuseScore#34146
Resolves: musescore/MuseScore#34147
Resolves: musescore/MuseScore#34145

Previously, the toolbars' alignment was recomputed reactively from geometryChange, which required manual state (m_pendingWidth), a forced synchronous layout resize and a deferred QTimer-based fixup, because KDDockWidgets' QtQuick layer syncs item sizes asynchronously.

Now all triggers (window resize, content size, visibility, floating state) just call polish(), and a single idempotent relayout pass runs from updatePolish() - after the frame's geometry and bindings have settled, but before rendering, so intermediate layout states are never drawn. The pass lives in a new TopLevelToolBarsLayout class: it adjusts compact mode, recomputes the alignment pins, syncs the layouting items' cached minimums and applies the layout size.

@coderabbitai

coderabbitai Bot commented Jul 14, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@Eism, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 28 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: ee91f1a3-27ae-4e12-b2ad-82b3088daf4f

📥 Commits

Reviewing files that changed from the base of the PR and between 6bbf3c1 and ae677c0.

📒 Files selected for processing (11)
  • framework/dockwindow_v2/CMakeLists.txt
  • framework/dockwindow_v2/internal/dockbase.cpp
  • framework/dockwindow_v2/internal/dockbase.h
  • framework/dockwindow_v2/qml/Muse/Dock/CMakeLists.txt
  • framework/dockwindow_v2/qml/Muse/Dock/dockframemodel.cpp
  • framework/dockwindow_v2/qml/Muse/Dock/dockwindow.cpp
  • framework/dockwindow_v2/qml/Muse/Dock/dockwindow.h
  • framework/dockwindow_v2/qml/Muse/Dock/topleveltoolbarslayout.cpp
  • framework/dockwindow_v2/qml/Muse/Dock/topleveltoolbarslayout.h
  • framework/dockwindow_v2/tests/CMakeLists.txt
  • framework/dockwindow_v2/tests/topleveltoolbarslayout_tests.cpp
📝 Walkthrough

Walkthrough

Introduces TopLevelToolBarsLayout to manage top-level toolbar connections, available-space adjustment, alignment, and layout sizing. DockWindow now delegates toolbar relayout through polish handling and removes timer-based layout state and connection tracking. The new implementation is added to the QML module build, while DockBase grants it friend access and skips size-constraint propagation for floating docks in the main window.

🚥 Pre-merge checks | ✅ 2 | ❌ 3

❌ Failed checks (2 warnings, 1 inconclusive)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description gives the issue links and a summary, but it omits the required checklist and most template sections. Fill in the template sections, especially the checklist items, CLA, testing, commit-message notes, and unnecessary-changes confirmation.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title is related to the PR, but it's too generic to describe the actual stabilization change. Use a short, specific title that mentions the toolbar relayout or DockWindow V2 stabilization work instead of only "Step 2".
✅ Passed checks (2 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The layout refactor, size-constraint guard, and added tests align with the crash, panel-shift, and missing-text issues.
Out of Scope Changes check ✅ Passed The CMake, test, and helper-class changes support the toolbar relayout work and don't appear unrelated.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@framework/dockwindow_v2/qml/Muse/Dock/topleveltoolbarslayout.cpp`:
- Around line 90-243: Add targeted unit tests for
TopLevelToolBarsLayout::adjustContentForAvailableSpace and alignToolBars,
covering compacting and expanding transitions, priority ordering, insufficient
or exact available width, and left/center/right alignment combinations including
missing blocks. Use realistic DockBase/DockToolBarView fixtures and assert
resulting compact states and width constraints.
- Around line 90-152: Update the compacting loop in adjustDocks within
adjustContentForAvailableSpace so it rechecks the updated width after each dock
is compacted and stops once width is below spaceWidth. Preserve the existing
priority ordering and eligibility checks, while avoiding compaction of
additional non-compact docks after sufficient space has been freed.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: a8c8c1ae-5749-4a85-bd85-4340ff23c6b2

📥 Commits

Reviewing files that changed from the base of the PR and between aee9f67 and 79374e2.

📒 Files selected for processing (7)
  • framework/dockwindow_v2/internal/dockbase.cpp
  • framework/dockwindow_v2/internal/dockbase.h
  • framework/dockwindow_v2/qml/Muse/Dock/CMakeLists.txt
  • framework/dockwindow_v2/qml/Muse/Dock/dockwindow.cpp
  • framework/dockwindow_v2/qml/Muse/Dock/dockwindow.h
  • framework/dockwindow_v2/qml/Muse/Dock/topleveltoolbarslayout.cpp
  • framework/dockwindow_v2/qml/Muse/Dock/topleveltoolbarslayout.h

Comment thread framework/dockwindow_v2/qml/Muse/Dock/topleveltoolbarslayout.cpp
Comment thread framework/dockwindow_v2/qml/Muse/Dock/topleveltoolbarslayout.cpp
@Eism Eism force-pushed the kddock_v2_toolbarsresize_fix branch from 79374e2 to 6bbf3c1 Compare July 14, 2026 12:54

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@framework/dockwindow_v2/internal/dockbase.cpp`:
- Around line 715-717: Update onIsInMainWindowChanged() so m_floating is
refreshed before invoking applySizeConstraints(). Ensure applySizeConstraints()
evaluates the current floating state, allowing the redocking constraint pass to
run instead of returning based on stale state.

In `@framework/dockwindow_v2/qml/Muse/Dock/topleveltoolbarslayout.cpp`:
- Around line 96-140: Update the adjustDocks lambda to calculate occupied width
using the same inter-toolbar separators included by alignToolBars(), rather than
summing only dock content widths. Change the compacting and expansion boundary
checks so an exact fit is retained or expanded: compact only when occupied width
exceeds spaceWidth, and allow expansion when the resulting width is equal to
spaceWidth.

In `@framework/dockwindow_v2/tests/topleveltoolbarslayout_tests.cpp`:
- Around line 209-225: Update CompactToolBarsThatDoNotFit so the first toolbar’s
compact state reduces its modeled width via an isCompactChanged connection or
equivalent fixture behavior. Adjust the expectations to verify the first toolbar
becomes compact while the second remains expanded when the occupied width
reaches the 700-pixel window limit; keep nonCompactable uncompact.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: c51c0a7e-2730-466f-accd-3511a2f6008f

📥 Commits

Reviewing files that changed from the base of the PR and between 79374e2 and 6bbf3c1.

📒 Files selected for processing (11)
  • framework/dockwindow_v2/CMakeLists.txt
  • framework/dockwindow_v2/internal/dockbase.cpp
  • framework/dockwindow_v2/internal/dockbase.h
  • framework/dockwindow_v2/qml/Muse/Dock/CMakeLists.txt
  • framework/dockwindow_v2/qml/Muse/Dock/dockframemodel.cpp
  • framework/dockwindow_v2/qml/Muse/Dock/dockwindow.cpp
  • framework/dockwindow_v2/qml/Muse/Dock/dockwindow.h
  • framework/dockwindow_v2/qml/Muse/Dock/topleveltoolbarslayout.cpp
  • framework/dockwindow_v2/qml/Muse/Dock/topleveltoolbarslayout.h
  • framework/dockwindow_v2/tests/CMakeLists.txt
  • framework/dockwindow_v2/tests/topleveltoolbarslayout_tests.cpp

Comment thread framework/dockwindow_v2/internal/dockbase.cpp
Comment thread framework/dockwindow_v2/qml/Muse/Dock/topleveltoolbarslayout.cpp
Comment thread framework/dockwindow_v2/tests/topleveltoolbarslayout_tests.cpp
Eism added 2 commits July 14, 2026 16:25
Replaced reactive geometryChange handling (pendingWidth, forced sync resize, deferred QTimer fixup) with one idempotent pass in updatePolish(), extracted it into TopLevelToolBarsLayout.
Skip applying floating size constraints while the dock's group is still in the main
layout - fixes the top row growing taller on undock.
@Eism Eism force-pushed the kddock_v2_toolbarsresize_fix branch from 6bbf3c1 to ae677c0 Compare July 14, 2026 13:25
@Eism

Eism commented Jul 14, 2026

Copy link
Copy Markdown
Collaborator Author

/build
musescore: musescore/MuseScore/main
musescore platforms: linux_x64 macos windows_x64

@github-actions

Copy link
Copy Markdown

@Eism

Eism commented Jul 14, 2026

Copy link
Copy Markdown
Collaborator Author

/build
musescore: musescore/MuseScore/main
musescore platforms: linux_x64 macos windows_x64

@github-actions

Copy link
Copy Markdown

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

Labels

None yet

Projects

None yet

2 participants