Fix a couple of issues with key signatures and transposing instruments #14849
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Resolves: #14675
Resolves: #14873
(First issue) The regression happened in #13999. That PR (correctly) filters out local key signatures (i.e. key signatures which are not in all staves). But that relies on the fact that global key signatures must be added to all staves, even if a specific staff ends up being in C because of transposition. Instead, when setting the key of the score via the score-creation dialog, instruments with resulting key in C were not given a key signature, so the key sig was interpreted as local and therefore not applied to the new instrument. Now the keySigEvent is always generated at the start of the score, regardless of being in C or not.
(Second issue) When changing instrument, we were transposing the instrument multiple times (once per excerpt in which the instrument is present.