Key signatures displayed incorrectly after clef change

• Apr 8, 2019 - 18:17
Reported version
3.1
Priority
P1 - High
Type
Functional
Frequency
Once
Severity
S3 - Major
Reproducibility
Always
Status
closed
Regression
No
Workaround
No
Project

This is an issue on both 3.0.5 and master:

1) default score, or a new score from treble template with enough measures for at least two systems
2) add key signature to first measure
3) add bass clef to second measure

Result: key signature displayed incorrectly on second & subsequent systems, as if the clef change didn't happen Fixes itself on next relayout, but then Undo then leaves the new keysig in place on the old clef.


Comments

The problem seems to be that in KeySig::layout(), we are looking to see if we can find a clef at the same tick, and we find the clef just to the left of us, which hasn't been updated yet - keysigs are laid out before clefs in addSystemHeader().

We could consider changing that order, but that could have unknown consequences. Better might be to not do this "check same tick" thing at all, and just fall through to the next chunk of code that uses the cleflist instead. That too might fail in some case I'm not thinking of offhand - either way, thorough testing would be required.

Here's the PR where the check for clefs was added, some discussion in the threads there that should give some good insight into things to watch out for: https://github.com/musescore/MuseScore/pull/3694

Status active PR created

Marc's idea of laying out clefs before keysigs in addSystemHeader() seems like the way to go, since the header clef comes before the key signature anyway, and the display of the key signature depends on the header clef being correct. I just tested it and it solves the issue. I can't think of any problems that would be caused by correcting the layout order of these two elements.

PR is here: https://github.com/musescore/MuseScore/pull/4942.

In reply to by Jojo-Schmitz

I am using MuseScore 3.2.3, but the problem is still there, see the screenshot attached. I have also attached the MuseScore file which demonstrates the problem.

UPDATE: Sorry, I think I understand what is happening. That flat in measure 11 actually refers to the note Bflat4 and should be entered as such and NOT as the key signature of the treble clef. When I got to entering measure 14 where one switches to the bass clef and noticed that it has no key signature I realised that the key signatures are not entered after the clef sign, but rather as an "accidental" on the first note that is affected by it and is encountered in the same measure. Please forgive my confusion --- this is the very first time in my life I am entering music score :)

Attachment Size
MuseScore-3.2.3-Bug.png 183.86 KB
Marcello-Bach-BWV_974.mscz 26.38 KB
Reported version 3.1 4.0

I'm having that issue right here, it's supposed to shift position when the Clef changes. Hopefully we can get that fixed.

Indeed, sounds like you are talking about something entirely unrelated; the bug discussed here was fixed years ago. If you're having some sort of problem that you believe to be a bug, please open a new issue and be sure to attach your score and precise steps to reproduce the problem.

Reported version 4.0 3.1

Again, whatever you are seeing is completely unrelated to this bug that was fixed years ago. Please open a new issue and describe your new issue in detail, with score and steps to reproduce. Do not change the settings for this long-resolved issue.

Title Key signatures displayed incorrectly after clef change Key signatures displayed incorrectly after clef change on Continous View
Reported version 3.1 4.0

I switched to continuous view & I saw the issue, the key signature is supposed to change position on the Continuous view (you can actually see it on the far left).

Title Key signatures displayed incorrectly after clef change on Continous View Key signatures displayed incorrectly after clef change
Reported version 4.0 3.1

Please, again, open a new issue for that, it is unrelated to the issue at hand here

Fix version
3.1.0