Skip to content

Conversation

@XiaoMigros
Copy link
Contributor

@XiaoMigros XiaoMigros commented Aug 31, 2025

Resolves: #24922
Resolves: #26612
Resolves: #29611

  • 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)

@XiaoMigros XiaoMigros force-pushed the fix-naturals-keysig branch 15 times, most recently from cc3845f to 4622c48 Compare August 31, 2025 21:36
@its-not-nice its-not-nice self-requested a review September 1, 2025 05:04
@XiaoMigros XiaoMigros changed the title Fix #24922, 26612: Refactor naturals in key signatures Fix #24922, 26612: Refactor key signatures Sep 1, 2025
@XiaoMigros XiaoMigros force-pushed the fix-naturals-keysig branch 2 times, most recently from 611b124 to 8c14f71 Compare September 1, 2025 09:15
@XiaoMigros XiaoMigros marked this pull request as draft September 5, 2025 11:00
@XiaoMigros XiaoMigros force-pushed the fix-naturals-keysig branch 8 times, most recently from 12d2ecc to bce2006 Compare September 5, 2025 13:01
@bkunda bkunda moved this to To do in MuseScore Studio 4.7 Sep 30, 2025
@bkunda bkunda moved this from To do to Needs Review in MuseScore Studio 4.7 Sep 30, 2025
Copy link
Contributor

@mike-spa mike-spa left a comment

Choose a reason for hiding this comment

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

@XiaoMigros left a few comments. Please also rebase if possible

if (staff() && segment()) {
const Fraction changeTick = staff()->currentKeyTick(tick());
if (Segment* s = score()->tick2segment(changeTick, true, SegmentType::KeySig)) {
return toKeySig(s->element(staff2track(staffIdx())));
Copy link
Contributor

Choose a reason for hiding this comment

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

This doesn't look right to me, or I'm not understanding it. It looks like you're delegating the properties of this key signature to the "initial" key signature that established the current key... why? Pid::IS_COURTESY looks especially strange, cause being a courtesy is certainly a property of the individual key sig, not a general one

Copy link
Contributor Author

@XiaoMigros XiaoMigros Oct 16, 2025

Choose a reason for hiding this comment

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

The principal reason for this is that when switching from a non-C key to C, you can't modify Pid::IS_COURTESY (or any other property) of the new C key because only the generated courtesy key signature on the previous system has a clickable hitbox.

I also found allowing property delegation for key signatures also solves some other minor bugs (such as the properties window still showing clickable options for generated keysigs, but not doing anything), but I'll admit I'm not particularly happy with this solution (especially since we have to go looking for the initial key signature in this fashion.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, got it thanks. Then if this delegation is meant to only apply from the courtesy onto the corresponding "main" signature, I'd suggest to be more explicit about it, for instance:

  • check if the current keySig is a courtesy (if it isn't, no need to delegate)
  • if you're on a courtesy keySig segment, you'll find the corresponding main keySig just a few segments ahead, you can probably do with a single s->next1(SegmentType::KEY_SIG) call, no need to use tick2Segment which is quite expensive

@XiaoMigros XiaoMigros force-pushed the fix-naturals-keysig branch 3 times, most recently from 833dc04 to 2ab883d Compare October 16, 2025 10:02
Copy link
Contributor

@mike-spa mike-spa left a comment

Choose a reason for hiding this comment

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

Final couple of comments

@XiaoMigros
Copy link
Contributor Author

SEGV in the VTests, not sure if that's due to the property delegation changes or the rebase. Will investigate...

@mike-spa mike-spa force-pushed the fix-naturals-keysig branch from a1438bb to dc36a1d Compare October 17, 2025 09:12
@mike-spa
Copy link
Contributor

@XiaoMigros I've pushed the crash fix directly to your branch to speed things up. I'm now going to add some quick UI elements that we've agreed with our design team to expose your new option for naturals, then we'll merge :)

@XiaoMigros
Copy link
Contributor Author

Thank you :))

@mike-spa mike-spa force-pushed the fix-naturals-keysig branch from 3a4d22f to 4711bf6 Compare October 17, 2025 10:15
@XiaoMigros XiaoMigros changed the title Fix #24922, 26612: Refactor key signatures Fix #24922, 26612, 29611: Refactor key signatures Oct 17, 2025
@mike-spa mike-spa force-pushed the fix-naturals-keysig branch from 4711bf6 to ef7dc60 Compare October 17, 2025 13:32
@bkunda
Copy link

bkunda commented Oct 20, 2025

Looks good from my end! Approved.

@mike-spa mike-spa merged commit 50824a1 into musescore:master Oct 20, 2025
12 checks passed
@github-project-automation github-project-automation bot moved this from Needs Review to Needs porting in MuseScore Studio 4.7 Oct 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

5 participants