Skip to content

Move setDotRelativeLine to ChordLayout#33022

Open
miiizen wants to merge 2 commits intomusescore:masterfrom
miiizen:moveNoteDotLineFunc
Open

Move setDotRelativeLine to ChordLayout#33022
miiizen wants to merge 2 commits intomusescore:masterfrom
miiizen:moveNoteDotLineFunc

Conversation

@miiizen
Copy link
Copy Markdown
Contributor

@miiizen miiizen commented Apr 15, 2026

Some misc tidying. This is only ever called from ChordLayout and removes one more renderer()->layoutItem call.

@miiizen miiizen requested a review from mike-spa April 15, 2026 09:49
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 15, 2026

📝 Walkthrough

Walkthrough

The pull request refactors dot positioning logic by removing the Note::setDotRelativeLine() method from the domain model and introducing a new ChordLayout::setDotRelativeLine() function in the rendering layer. The implementation computes dot vertical positions, manages dot element lifecycle, and performs layout operations. Call sites in chord layout operations are updated to use the new context-aware helper function, and the ChordLayout::placeDots() signature is modified to accept a LayoutContext parameter.

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The pull request description is minimal and lacks required template sections like issue reference, purpose explanation, and verification checkboxes that should be completed. Complete the PR description template by adding issue reference (Resolves: #), detailed motivation, and checking off applicable checklist items to demonstrate compliance with contribution guidelines.
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the primary change: moving the setDotRelativeLine function from the Note class to ChordLayout, which is the main refactoring objective.

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

@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 the current code and only fix it if needed.

Inline comments:
In `@src/engraving/rendering/score/chordlayout.cpp`:
- Around line 2574-2583: The assignment to y inside the !tab->onLines() branch
is dead because y is immediately overwritten by the subsequent dotMove
conditional; remove the unreachable branch or refactor so the onLines() check
actually affects the dot positioning. Specifically, update the logic around
tab->onLines(), dotMove and note->voice() (the y variable assignment in this
block of chordlayout.cpp) so either (a) delete the if (!tab->onLines()) { y =
-0.5; } line, or (b) wrap the dotMove/voice-based assignment in an outer if/else
that differentiates behavior when tab->onLines() is false versus true,
preserving the intended fret-mark adjustment while ensuring y is not
overwritten.
🪄 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: 8ccc3848-4ec2-42c1-a80a-f15d4b499c43

📥 Commits

Reviewing files that changed from the base of the PR and between e01205d and a65e099.

📒 Files selected for processing (4)
  • src/engraving/dom/note.cpp
  • src/engraving/dom/note.h
  • src/engraving/rendering/score/chordlayout.cpp
  • src/engraving/rendering/score/chordlayout.h
💤 Files with no reviewable changes (2)
  • src/engraving/dom/note.h
  • src/engraving/dom/note.cpp

Comment on lines +2574 to +2583
if (!tab->onLines()) {
// if fret marks above lines, raise the dots by half line distance
y = -0.5;
}
if (dotMove == 0) {
bool oddVoice = note->voice() & 1;
y = oddVoice ? 0.5 : -0.5;
} else {
y = 0.5;
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Description: Search for any history or comments about the onLines() TAB dot logic
# to understand if this dead code was intentional

# Search for related comments or TODOs
rg -n -C3 'onLines|fret marks above' --type=cpp src/engraving/

Repository: musescore/MuseScore

Length of output: 12165


🏁 Script executed:

# Search for the original Note::setDotRelativeLine
rg -n 'Note::setDotRelativeLine' --type=cpp src/

Repository: musescore/MuseScore

Length of output: 45


🏁 Script executed:

# Search for other dot-related positioning logic
rg -n 'setDotRelativeLine|dotMove|NoteDot' --type=cpp src/engraving/rendering/ -A2 -B2 | head -100

# Check if there's a prior version of this function or related logic
git log --oneline -n 20 src/engraving/rendering/score/chordlayout.cpp

Repository: musescore/MuseScore

Length of output: 8044


🏁 Script executed:

# Show the commit that moved setDotRelativeLine to ChordLayout
git show a65e0990e9 --stat

# Also search for where this function came from before the move
git show a65e0990e9 -- src/engraving/rendering/score/chordlayout.cpp | head -200

Repository: musescore/MuseScore

Length of output: 50376


🏁 Script executed:

# Get the specific diff for the setDotRelativeLine function in the commit
git show a65e0990e9 -- src/engraving/rendering/score/chordlayout.cpp | grep -A 40 "setDotRelativeLine"

Repository: musescore/MuseScore

Length of output: 11084


🏁 Script executed:

# Search for where setDotRelativeLine existed before this commit
git log --all --source --reverse -S "setDotRelativeLine" -- src/dom/note.cpp | head -20

# Also check if it existed in note.cpp at all
git show a65e0990e9^:src/dom/note.cpp 2>/dev/null | grep -A 50 "setDotRelativeLine" | head -60

Repository: musescore/MuseScore

Length of output: 45


🏁 Script executed:

# Check the parent commit to see what was there before
git show a65e0990e9^:src/engraving/rendering/score/chordlayout.cpp 2>/dev/null | wc -l

# Search for setDotRelativeLine in all files in the parent commit
git show a65e0990e9^ | grep -l "setDotRelativeLine" 2>/dev/null || echo "Not found in parent commit"

# Let's check the specific lines in the current code to understand the TAB logic
git show HEAD:src/engraving/rendering/score/chordlayout.cpp | sed -n '2564,2615p'

Repository: musescore/MuseScore

Length of output: 2064


Remove or refactor the unreachable !tab->onLines() branch.

The assignment y = -0.5 when !tab->onLines() is true (line 2576) is immediately overwritten by the subsequent if (dotMove == 0) ... else ... block (lines 2578-2583). This branch is dead code and should be either removed or refactored if the intent was to condition the entire if/else block on the stemThrough() and onLines() checks.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/engraving/rendering/score/chordlayout.cpp` around lines 2574 - 2583, The
assignment to y inside the !tab->onLines() branch is dead because y is
immediately overwritten by the subsequent dotMove conditional; remove the
unreachable branch or refactor so the onLines() check actually affects the dot
positioning. Specifically, update the logic around tab->onLines(), dotMove and
note->voice() (the y variable assignment in this block of chordlayout.cpp) so
either (a) delete the if (!tab->onLines()) { y = -0.5; } line, or (b) wrap the
dotMove/voice-based assignment in an outer if/else that differentiates behavior
when tab->onLines() is false versus true, preserving the intended fret-mark
adjustment while ensuring y is not overwritten.

@miiizen miiizen added the vtests This PR produces approved changes to vtest results label Apr 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

vtests This PR produces approved changes to vtest results

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant