Skip to content

Fix #33520: Allow unhidden instruments in part scores#33563

Open
officialasishkumar wants to merge 1 commit into
musescore:mainfrom
officialasishkumar:fix-part-score-unhide-instruments
Open

Fix #33520: Allow unhidden instruments in part scores#33563
officialasishkumar wants to merge 1 commit into
musescore:mainfrom
officialasishkumar:fix-part-score-unhide-instruments

Conversation

@officialasishkumar
Copy link
Copy Markdown

Resolves: #33520

Part-score Layout panel rows for instruments that do not yet exist in the current part score were initialized disabled, so the visibility control could not create and show them until another score change refreshed the row state. This keeps nonexistent master-part rows enabled and reuses the same enabled-state rule during score-change refresh, while existing rows still respect enabled shared parts.

Validation:

  • git diff --check

  • cmake -P /tmp/MuseScore/muse/buildscripts/ci/checkcodestyle/checkcodestyle.cmake src/instrumentsscene/qml/MuseScore/InstrumentsScene/internal

  • I signed the CLA

  • The title of the PR describes the problem it addresses

  • Each commit's message describes its purpose and effects, and references the issue it resolves

  • If changes are extensive, there is a sequence of easily reviewable commits

  • The code in the PR follows the coding rules

  • There are no unnecessary changes

  • The code compiles and runs on my machine, preferably after each commit individually

  • I created a unit test or vtest to verify the changes I made (if applicable)

Keep master-part rows enabled when the part does not yet exist in the current part score so toggling visibility can create and show the instrument.

Share the enabled-state rule between initial model setup and score-change refresh to avoid the inconsistent state that previously corrected itself only after another edit.

Resolves: musescore#33520
Copy link
Copy Markdown

@claude claude Bot left a comment

Choose a reason for hiding this comment

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

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 24, 2026

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: a227e403-0085-47f8-a288-97999e73d4e9

📥 Commits

Reviewing files that changed from the base of the PR and between 81d6e24 and 3df6875.

📒 Files selected for processing (1)
  • src/instrumentsscene/qml/MuseScore/InstrumentsScene/internal/parttreeitem.cpp

📝 Walkthrough

Walkthrough

This PR refactors PartTreeItem to eliminate duplicated "enabled" state logic. A new internal helper isPartItemEnabled(const Part* part, bool partExists) centralizes the computation that was previously inlined in multiple places. The helper is called during init() and onScoreChanged() to determine whether a part tree item should be enabled based on part existence and shared-part status. Lines changed: +11/−4.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
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.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the fix for issue #33520, focusing on allowing unhidden instruments in part scores, which matches the main problem being addressed.
Description check ✅ Passed The description covers the issue being resolved, explains the problem and solution, and includes validation steps. However, the CLA checkbox and some testing checkboxes remain unchecked.
Linked Issues check ✅ Passed The code changes successfully address issue #33520 by centralizing the enabled-state logic and applying it during initialization and score updates, allowing nonexistent instruments to be toggled visible without requiring a subsequent score change.
Out of Scope Changes check ✅ Passed All changes are focused on fixing the enabled-state logic in PartTreeItem, directly addressing the linked issue with no extraneous modifications.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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 and usage tips.

@mathesoncalum mathesoncalum self-requested a review May 25, 2026 07:02
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.

Instruments in parts may not be unhidden if those instruments have never been visible before

3 participants