Skip to content

Optimization: load popups only when needed#33476

Open
RomanPudashkin wants to merge 1 commit into
musescore:mainfrom
RomanPudashkin:fix_unnecessary_popup_loading
Open

Optimization: load popups only when needed#33476
RomanPudashkin wants to merge 1 commit into
musescore:mainfrom
RomanPudashkin:fix_unnecessary_popup_loading

Conversation

@RomanPudashkin
Copy link
Copy Markdown
Contributor

@RomanPudashkin RomanPudashkin added performance Performance issues (e.g. high CPU usage) tech debt labels May 19, 2026
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.

@RomanPudashkin RomanPudashkin requested a review from Eism May 19, 2026 12:41
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 19, 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: 45c5994b-a498-4809-bd78-7e5430b64656

📥 Commits

Reviewing files that changed from the base of the PR and between 1cce99d and fb4e8bd.

📒 Files selected for processing (12)
  • src/notationscene/qml/MuseScore/NotationScene/NoteInputBar.qml
  • src/palette/qml/MuseScore/Palette/internal/PalettesPanelHeader.qml
  • src/playback/qml/MuseScore/Playback/internal/PlaybackToolBarActions.qml
  • src/project/qml/MuseScore/Project/internal/NewScore/KeySignatureSettings.qml
  • src/project/qml/MuseScore/Project/internal/NewScore/MeasuresSettings.qml
  • src/project/qml/MuseScore/Project/internal/NewScore/TempoSettings.qml
  • src/project/qml/MuseScore/Project/internal/NewScore/TimeSignatureSettings.qml
  • src/propertiespanel/qml/MuseScore/PropertiesPanel/CMakeLists.txt
  • src/propertiespanel/qml/MuseScore/PropertiesPanel/common/PropertiesPanelPopupButton.qml
  • src/propertiespanel/qml/MuseScore/PropertiesPanel/general/GeneralSection.qml
  • src/propertiespanel/qml/MuseScore/PropertiesPanel/measures/MeasuresSection.qml
  • src/propertiespanel/qml/MuseScore/PropertiesPanel/notation/NotationMultiElementView.qml
✅ Files skipped from review due to trivial changes (1)
  • src/propertiespanel/qml/MuseScore/PropertiesPanel/notation/NotationMultiElementView.qml

📝 Walkthrough

Walkthrough

This pull request refactors QML popup buttons across MuseScore's UI modules from manual popup state management to the PopupButton/popupComponent pattern. It introduces PropertiesPanelPopupButton as a reusable FlatButton-based popup component with focus handling, open-state tracking, and vertical-space visibility checks. NoteInputBar, PalettesPanelHeader, and PlaybackToolBarActions are migrated to PopupButton, and NewScore settings components (KeySignature, Measures, Tempo, TimeSignature) swap FlatButton for PopupButton while consolidating popup wiring via popupComponent. Consumer modules update references from PopupViewButton to PropertiesPanelPopupButton. Pragmas and explicit popup alias exports are removed in favor of PopupButton's built-in popup lifecycle management.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description is minimal and incomplete. It lacks the structured template sections, missing motivation details, required PR checklist items, and context beyond the external dependency reference. Add a comprehensive description following the template: include issue resolution, motivation for changes, and complete all required PR checklist items (CLA, title validation, commit messages, testing, etc.).
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main optimization: deferring popup loading until they are needed, which accurately reflects the changeset's primary purpose.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ 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.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

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 `@muse`:
- Line 1: The PR pins the muse submodule to an unstable, unmerged commit SHA
(c7e8671d5fb751e4376a347f7a6b16b0af46c9ef) which is the head of muse_framework
PR 40; revert this pin and instead wait for muse_framework PR 40 to be merged,
then update the submodule reference (the commit SHA stored for the muse
submodule) to the stable commit on main produced by that merge; ensure the
change updates the submodule entry (where the commit is recorded) rather than
pointing at an open PR head so the repository remains reproducible.

In `@src/inspector/qml/MuseScore/Inspector/common/InspectorPopupButton.qml`:
- Around line 117-125: The checkForInsufficientSpace() helper in
InspectorPopupButton.qml assumes root.anchorItem always exists, which can
trigger a QML runtime error when the popup opens without an anchor. Add a guard
at the start of checkForInsufficientSpace() to return early if root.anchorItem
is null/undefined before calling mapToItem or reading anchorItem.height, and
keep the existing geometry logic unchanged for the valid anchored case.

In
`@src/project/qml/MuseScore/Project/internal/NewScore/KeySignatureSettings.qml`:
- Line 33: The current readonly property mode uses bar.currentIndex before bar
exists (due to popupComponent lazy loading), so add a root-level property
modeIndex (numeric) initialized to 0 and replace references to mode with a
derived getter/setter or computed string based on modeIndex (e.g., modeIndex ===
0 ? "major" : "minor"); when the popup/popupComponent loads, bind/sync modeIndex
bidirectionally with the internal bar component by setting bar.currentIndex =
modeIndex on load and attaching a handler to update modeIndex when
bar.currentIndex changes (and vice versa) so the header and list view track mode
correctly; update analogous bindings at the other affected spots (the uses
originally at lines 44 and 62–63) to read/write modeIndex instead of directly
referencing bar.currentIndex.
🪄 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: CHILL

Plan: Pro

Run ID: 79a1fd14-a8d7-49c9-bb2f-ad3bd4d66aea

📥 Commits

Reviewing files that changed from the base of the PR and between 283bb5b and b2f2ff7.

📒 Files selected for processing (15)
  • muse
  • src/inspector/qml/MuseScore/Inspector/CMakeLists.txt
  • src/inspector/qml/MuseScore/Inspector/common/InspectorPopupButton.qml
  • src/inspector/qml/MuseScore/Inspector/common/PopupViewButton.qml
  • src/inspector/qml/MuseScore/Inspector/general/GeneralInspectorView.qml
  • src/inspector/qml/MuseScore/Inspector/measures/MeasuresInspectorView.qml
  • src/inspector/qml/MuseScore/Inspector/notation/NotationMultiElementView.qml
  • src/inspector/qml/MuseScore/Inspector/score/ScoreAppearanceInspectorView.qml
  • src/notationscene/qml/MuseScore/NotationScene/NoteInputBar.qml
  • src/palette/qml/MuseScore/Palette/internal/PalettesPanelHeader.qml
  • src/playback/qml/MuseScore/Playback/internal/PlaybackToolBarActions.qml
  • src/project/qml/MuseScore/Project/internal/NewScore/KeySignatureSettings.qml
  • src/project/qml/MuseScore/Project/internal/NewScore/MeasuresSettings.qml
  • src/project/qml/MuseScore/Project/internal/NewScore/TempoSettings.qml
  • src/project/qml/MuseScore/Project/internal/NewScore/TimeSignatureSettings.qml
💤 Files with no reviewable changes (1)
  • src/inspector/qml/MuseScore/Inspector/common/PopupViewButton.qml

Comment thread muse Outdated
Comment thread src/project/qml/MuseScore/Project/internal/NewScore/KeySignatureSettings.qml Outdated
@RomanPudashkin RomanPudashkin force-pushed the fix_unnecessary_popup_loading branch 2 times, most recently from 23e35c0 to 1cce99d Compare May 19, 2026 13:42
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 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 `@muse`:
- Line 1: The repository's muse submodule is pinned to an unmerged PR commit
(muse_framework PR `#40`, SHA 98ee69c042d6e4bd09934b4047b6ee2ca040299e); update
the submodule reference in .gitmodules and the gitlink to point to a commit that
is merged into the muse_framework main branch (or remove the PR-SHA pin and
track main), then commit the updated submodule pointer and push; ensure the new
commit SHA you set is from muse_framework main (not the PR branch) and mention
PR `#40` in your commit message for traceability.
🪄 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: CHILL

Plan: Pro

Run ID: fe63d137-7cc6-45c5-9c36-11c55776cd5d

📥 Commits

Reviewing files that changed from the base of the PR and between b2f2ff7 and 1cce99d.

📒 Files selected for processing (15)
  • muse
  • src/inspector/qml/MuseScore/Inspector/CMakeLists.txt
  • src/inspector/qml/MuseScore/Inspector/common/InspectorPopupButton.qml
  • src/inspector/qml/MuseScore/Inspector/common/PopupViewButton.qml
  • src/inspector/qml/MuseScore/Inspector/general/GeneralInspectorView.qml
  • src/inspector/qml/MuseScore/Inspector/measures/MeasuresInspectorView.qml
  • src/inspector/qml/MuseScore/Inspector/notation/NotationMultiElementView.qml
  • src/inspector/qml/MuseScore/Inspector/score/ScoreAppearanceInspectorView.qml
  • src/notationscene/qml/MuseScore/NotationScene/NoteInputBar.qml
  • src/palette/qml/MuseScore/Palette/internal/PalettesPanelHeader.qml
  • src/playback/qml/MuseScore/Playback/internal/PlaybackToolBarActions.qml
  • src/project/qml/MuseScore/Project/internal/NewScore/KeySignatureSettings.qml
  • src/project/qml/MuseScore/Project/internal/NewScore/MeasuresSettings.qml
  • src/project/qml/MuseScore/Project/internal/NewScore/TempoSettings.qml
  • src/project/qml/MuseScore/Project/internal/NewScore/TimeSignatureSettings.qml
💤 Files with no reviewable changes (1)
  • src/inspector/qml/MuseScore/Inspector/common/PopupViewButton.qml
🚧 Files skipped from review as they are similar to previous changes (10)
  • src/inspector/qml/MuseScore/Inspector/CMakeLists.txt
  • src/inspector/qml/MuseScore/Inspector/measures/MeasuresInspectorView.qml
  • src/notationscene/qml/MuseScore/NotationScene/NoteInputBar.qml
  • src/inspector/qml/MuseScore/Inspector/general/GeneralInspectorView.qml
  • src/playback/qml/MuseScore/Playback/internal/PlaybackToolBarActions.qml
  • src/inspector/qml/MuseScore/Inspector/notation/NotationMultiElementView.qml
  • src/project/qml/MuseScore/Project/internal/NewScore/TimeSignatureSettings.qml
  • src/inspector/qml/MuseScore/Inspector/score/ScoreAppearanceInspectorView.qml
  • src/palette/qml/MuseScore/Palette/internal/PalettesPanelHeader.qml
  • src/project/qml/MuseScore/Project/internal/NewScore/TempoSettings.qml

Comment thread muse Outdated
@RomanPudashkin RomanPudashkin force-pushed the fix_unnecessary_popup_loading branch from 1cce99d to fb4e8bd Compare May 21, 2026 09:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

performance Performance issues (e.g. high CPU usage) tech debt

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant