Key signature disappears when linked staff type is changed to "tab"

• Aug 24, 2012 - 14:03
S2 - Critical

After creating a score with a pair of linked staves and inserting a key signature, if one of the staves is changed to a tab the key signature disappears from the pitched staff as well.

The problem seem to be display only as adding a key signature at a later stage will remove any appropriate accidentals eg adding a G major key signature removes the sharp symbol from any Fs in the score but the key signature is not displayed when added at this stage either.

The same behaviour is seen in OS X musescore-a3d5580 and Windows 7 musescore-7c7d7a3


I think the problem is with function Score::addSystemHeader() (file libmscore/layout.cpp) which actually delete a key signature when the staff is a TAB (and upon some other conditions).

I am posting a pull request to Github with a fix specific for TAB's: in it the key sig. is not deleted, rather it is the TAB staff which should know key signatures do not apply to it (hiding them).

My opinion might well be wrong, as I do not have a full picture of the program, but I have two more general observations:

1) I do not think a layout function like Score::addSystemHeader() should actually delete anything structural like a key signature, but only hide it if conditions for displaying are not met. What if conditions change at a later stage (for instance, the user flips the ST_genKeysig flag) ? That info is now lost and cannot be reconstructed anymore.

2) This function, as well as few other layout functions, are skipped if in the process of undoing/redoing something belonging to the undo stack, as it might generate undo items. I believe it should be the other way around: layout functions should not generate undo items and -- as they construct the visible result of other, more structural, actions -- should be allowed to execute during undo/redo.

Of course, as I said above, I might be wrong...



Is the key signature really being deleted? Or just being hidden for all staves when a tab is linked. I haven't tried looking at the code but certainly the 'effect' of the key signature is as expected.

As you can see from this measure, with a key signature applied there is no sharp on the F# minim starting on beat 3


but before applying the key signature it is displayed as an accidental


The tab shows that although no key signature is displayed both are F#

Attachment Size
with key signature.png 12.18 KB
no key signature.png 12.48 KB

If you look at the function quoted above (line 774), the KeySig element is deleted.

The pull request with the fix (hopefully...) is posted.