Repository navigation
Fix context menu on collapsed clips - #12205
Conversation
📝 Walkthrough
Merge Risk: 🔵 Low · up to Collapsed clips may still have a narrow right-trim area that does not respond, and the header may hide during a right-click menu. These are localized interface risks; the right-click menu behavior remains uncertain. Pre-merge checks |
|
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI (base), Organization UI (inherited)
Review profile: CHILL
Plan: Advanced
Run ID: 0d8170fe-f8a8-4c24-8320-9ed8532679fd
📒 Files selected for processing (1)
src/projectscene/qml/Audacity/ProjectScene/tracksitemsview/ClipItem.qml
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.
| z: 2 | ||
|
|
||
| visible: !root.collapsed || root.hover | ||
| visible: !root.collapsed || root.hover || menuBtn.isMenuOpened |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
set -eu
printf '%s\n' '--- candidate files ---'
fd -i '.*(ClipItem|ContextMenuLoader|MenuButton).*' src | head -80
printf '%s\n' '--- relevant references ---'
rg -n -C 5 'singleClipContextMenuLoader|multiClipContextMenuLoader|isMenuOpened|ContextMenuLoader|MenuButton' src/projectscene/qml/Audacity/ProjectScene/tracksitemsview src/projectscene/qml 2>/dev/null | head -260Repository: audacity/audacity
Length of output: 28656
🏁 Script executed:
set -eu
printf '%s\n' '--- type definitions and imports ---'
rg -n -C 8 '(^|[[:space:]])(component[[:space:]]+)?(ContextMenuLoader|MenuButton)[[:space:]]*\{|ContextMenuLoader|MenuButton' src --glob '*.qml' --glob '*.qrc' --glob '*.cmake' | head -360
printf '%s\n' '--- QML files containing likely definitions ---'
rg -l 'ContextMenuLoader|isMenuOpened' src --glob '*.qml' | sortRepository: audacity/audacity
Length of output: 37187
🏁 Script executed:
set -eu
printf '%s\n' '--- exact definitions across tracked files ---'
git grep -n -E 'ContextMenuLoader|isMenuOpened|class[[:space:]]+MenuButton|MenuButton::|QML_ELEMENT|show[[:space:]]*\(' -- \
':!*.qml' ':!*.json' ':!*.ts' ':!*.js' | head -400
printf '%s\n' '--- QML imports for ClipItem ---'
sed -n '1,80p' src/projectscene/qml/Audacity/ProjectScene/tracksitemsview/ClipItem.qmlRepository: audacity/audacity
Length of output: 9700
🏁 Script executed:
set -eu
printf '%s\n' '--- tracked names ---'
git ls-files | rg -i 'context.*menu|menu.*button|qmldir|uicomponents' | head -240
printf '%s\n' '--- module metadata and relevant properties ---'
git grep -n -i -E 'Muse\.UiComponents|ContextMenuLoader|MenuButton|isMenuOpened' -- \
'*CMakeLists.txt' '*.cmake' '*.qmltypes' 'qmldir' '*.qrc' '*.pri' 2>/dev/null | head -300
printf '%s\n' '--- local MenuButton usage ---'
git grep -n -C 3 'MenuButton[[:space:]]*{' -- '*.qml' | head -180Repository: audacity/audacity
Length of output: 10777
🌐 Web query:
"ContextMenuLoader" "isMenuOpened" "MenuButton" Muse UiComponents
💡 Result:
<search_synthesis>
The components and concepts you mentioned (ContextMenuLoader, isMenuOpened, MenuButton) appear in the context of custom UI development within the MuseScore application, specifically within their muse::uicomponents framework, which utilizes QML [1][2]. In the MuseScore codebase, ContextMenuLoader and MenuButton are QML components used to handle context menus and their associated interaction logic [3]. For instance, MenuButton typically interfaces with a ContextMenuModel (e.g., PianoKeyboardPanelContextMenuModel or CloudAudioFileContextMenuModel), which inherits from muse::uicomponents::AbstractMenuModel [1][4]. The property isMenuOpened or similar state-tracking boolean values are often used in these components to manage the visible state of the menu during user interactions [3]. It is important to distinguish these components from: 1. Muse-UI: A separate, third-party Material Design UI library for Vue.js 2.0 [5][6]. 2. WPF UI: A library for WPF applications that also contains a component named ContextMenuLoader used for overwriting default context menu styles in specific UIElements [7][8]. In summary, when discussing ContextMenuLoader, MenuButton, and UiComponents in the same context, you are likely referring to the internal QML framework used by MuseScore [1][2]. If you are working in a different technical stack, the names likely refer to the WPF UI library or a coincidence in naming conventions across different projects [7][9].
</search_synthesis>
<source_evidence>
Citations:
- 1: https://github.com/musescore/MuseScore/blob/main/src/notationscene/qml/MuseScore/NotationScene/pianokeyboard/pianokeyboardpanelcontextmenumodel.h
- 2: musescore/MuseScore@e2e0e02
- 3: https://cephalochromoscope.net/472c833c-f85f-464e-b598-5524dc47e85b
- 4: https://cephalochromoscope.net/537d9928-7818-4c2b-9f2a-ae00e4553b20
- 5: https://github.com/museui/muse-ui/
- 6: https://numfer.com/museui/muse-ui
- 7: https://github.com/lepoco/wpfui/blob/main/src/Wpf.Ui/Controls/ContextMenu/ContextMenuLoader.xaml.cs
- 8: https://wpfui.lepo.co/api/Wpf.Ui.Controls.html
- 9: https://github.com/microsoft/PowerToys/blob/386a16ff/src/modules/launcher/Plugins/Microsoft.Plugin.Folder/ContextMenuLoader.cs
🌐 Web query:
site:github.com/musescore/MuseScore "ContextMenuLoader.qml" "isMenuOpened"
💡 Result:
<search_synthesis>
In the context of the MuseScore codebase, ContextMenuLoader.qml is a specialized QML component used for managing and displaying context menus. While standard Qt Quick Controls or internal implementations may use different property names, the codebases referencing ContextMenuLoader.qml often utilize an isMenuOpened property to track or react to the visibility state of the menu [1]. For example, in ViewModeControl.qml, the component's appearance is dynamically updated based on the state of the menu [1]: transparent:!menu.isMenuOpened accentButton: menu.isMenuOpened This property allows UI elements to adjust their styling (such as transparency or accent colors) to reflect whether the associated context menu is currently active [1]. Developers typically integrate this component by defining it with an id and then accessing its properties (like isMenuOpened) or calling its methods (like show) to trigger menu display [1][2]. If you are encountering issues where a menu fails to open or is not displaying correctly, it is often due to the loader not being properly placed or its parent/anchor item not being correctly defined [3].
</search_synthesis>
<source_evidence>
Citations:
- 1: https://github.com/musescore/MuseScore/blob/main/src/notationscene/qml/MuseScore/NotationScene/ViewModeControl.qml
- 2: https://github.com/musescore/MuseScore/blob/main/src/notationscene/qml/MuseScore/NotationScene/percussionpanel/PercussionPanelPadContent.qml
- 3: GitHub issue 29412 in musescore/MuseScore (link omitted to avoid creating a cross-reference)
🏁 Script executed:
set -eu
base='https://raw.githubusercontent.com/musescore/MuseScore/main/src/framework/uicomponents/qml/Muse/UiComponents'
for f in ContextMenuLoader.qml StyledMenuLoader.qml MenuButton.qml; do
printf '\n--- %s ---\n' "$f"
curl -fsSL "$base/$f" | sed -n '1,240p'
doneRepository: audacity/audacity
Length of output: 387
🏁 Script executed:
set -eu
printf '%s\n' '--- upstream filenames ---'
curl -fsSL 'https://api.github.com/repos/musescore/MuseScore/git/trees/main?recursive=1' |
jq -r '.tree[]?.path' |
rg '(^|/)(ContextMenuLoader|StyledMenuLoader|MenuButton)\.(qml|h|cpp)$|uicomponents.*(menu|button)' |
head -120
printf '%s\n' '--- Audacity dependency references ---'
git grep -n -i -E 'musescore|muse.*framework|framework.*revision|MUSE_.*VERSION|MUSE_.*COMMIT' -- \
'CMakeLists.txt' '*.cmake' '.gitmodules' 'buildscripts/**' 'cmake/**' 2>/dev/null | head -220Repository: audacity/audacity
Length of output: 7985
🏁 Script executed:
set -eu
printf '%s\n' '--- dependency submodule metadata ---'
cat .gitmodules
printf '%s\n' '--- muse_framework filenames ---'
curl -fsSL 'https://api.github.com/repos/musescore/muse_framework/git/trees/master?recursive=1' |
jq -r '.tree[]?.path' |
rg '(^|/)(ContextMenuLoader|StyledMenuLoader|MenuButton)\.(qml|h|cpp)$|uicomponents.*(menu|button)' |
head -160Repository: audacity/audacity
Length of output: 454
🏁 Script executed:
set -eu
branch=$(curl -fsSL https://api.github.com/repos/musescore/muse_framework | jq -r '.default_branch')
printf 'default branch: %s\n' "$branch"
curl -fsSL "https://api.github.com/repos/musescore/muse_framework/git/trees/$branch?recursive=1" |
jq -r '.tree[]?.path' |
rg -i '(^|/)(ContextMenuLoader|StyledMenuLoader|MenuButton)\.(qml|h|cpp)$|uicomponents.*(menu|button)' |
head -160Repository: audacity/audacity
Length of output: 2110
🏁 Script executed:
set -eu
base='https://raw.githubusercontent.com/musescore/muse_framework/main/framework/uicomponents/qml/Muse/UiComponents'
for f in ContextMenuLoader.qml StyledMenuLoader.qml MenuButton.qml; do
printf '\n--- %s ---\n' "$f"
curl -fsSL "$base/$f" | sed -n '1,260p'
doneRepository: audacity/audacity
Length of output: 8071
🏁 Script executed:
set -eu
sha=$(git ls-tree HEAD muse | awk '{print $3}')
printf 'muse gitlink: %s\n' "$sha"
base="https://raw.githubusercontent.com/musescore/muse_framework/$sha/framework/uicomponents/qml/Muse/UiComponents"
for f in ContextMenuLoader.qml MenuButton.qml; do
printf '\n--- %s at %s ---\n' "$f" "$sha"
curl -fsSL "$base/$f" | rg -n 'property alias isMenuOpened|function show|function open|StyledMenuLoader|signal opened|signal closed|onOpened|onClosed' || true
doneRepository: audacity/audacity
Length of output: 604
Keep collapsed clip headers visible while a context menu is open.
ContextMenuLoader.show() opens its own internal StyledMenuLoader. menuBtn.isMenuOpened tracks a separate loader owned by MenuButton. Right-click paths do not update that state. Therefore, the binding can hide a collapsed header after root.hover clears while its context menu remains open. Track the opened and closed signals from both context loaders in shared state, then include that state in this binding.
e2a8166 to
e41e543
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI (base), Organization UI (inherited)
- Review profile: CHILL
- Plan: Advanced
- Run ID:
6f084dab-c0f6-45e8-9be9-c352b6aecc0e
📒 Files selected for processing (1)
src/projectscene/qml/Audacity/ProjectScene/tracksitemsview/ClipHandles.qml
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.
|
|
||
| containmentMask: QtObject { | ||
| function contains(point: point): bool { | ||
| return point.x >= 0 && point.y >= 0 && point.x < rightTrimMa.width && point.y < rightTrimMa.height && !root.isExcluded(rightTrimMa, point) |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
#!/bin/bash
set -euo pipefail
rg -n -C 5 '\benableCursorInteraction\b|\bhandlesVisible\b|\bexclusionItem\b|\bcollapsed\b|menuBtn\.mouseArea\.visible' \
src/projectscene/qml/Audacity/ProjectScene/tracksitemsview/ClipItem.qmlRepository: audacity/audacity
Length of output: 7656
🏁 Script executed:
set -euo pipefail
printf '%s\n' '--- ClipItem.qml: header/menu/handles ---'
nl -ba src/projectscene/qml/Audacity/ProjectScene/tracksitemsview/ClipItem.qml | sed -n '560,850p;1145,1180p'
printf '%s\n' '--- ClipHandles.qml: properties and mouse areas ---'
nl -ba src/projectscene/qml/Audacity/ProjectScene/tracksitemsview/ClipHandles.qml | sed -n '1,80p;250,360p'Repository: audacity/audacity
Length of output: 21632
🏁 Script executed:
set -euo pipefail
printf '%s\n' '--- right trim handle block ---'
nl -ba src/projectscene/qml/Audacity/ProjectScene/tracksitemsview/ClipHandles.qml | sed -n '170,370p'
printf '%s\n' '--- enableCursorInteraction inputs ---'
rg -n -C 4 '\b(selectionInProgress|selectionEditInProgress|verticalSelectionEditInProgress|isBrush)\b' src/projectscene/qml/Audacity/ProjectScene/tracksitemsview src/projectscene/qml/Audacity/ProjectSceneRepository: audacity/audacity
Length of output: 41696
Tie the exclusion to menu interactivity.
A collapsed, selected clip can keep its trim handles and visible menu button while enableCursorInteraction is false. The exclusion currently checks only menuBtn.visible, but menuBtn.mouseArea.visible is false in that state. The right-trim mask can then reject the overlapping button area even though the menu cannot receive the press.
Suggested fix
- exclusionItem: root.collapsed ? menuBtn : null
+ exclusionItem: root.collapsed && menuBtn.mouseArea.visible ? menuBtn : nullFix context menu on collapsed clips
Resolves: #12204
Recommended: