@@ -443,39 +443,44 @@ int Rest::computeLineOffset(int lines)
443443 }
444444 }
445445
446+ if (offsetVoices) {
447+ // if the staff contains slash notation then don't offset voices
448+ int baseTrack = staffIdx () * VOICES;
449+ for (int v = 0 ; v < VOICES; ++v) {
450+ Element* e = s->element (baseTrack + v);
451+ if (e && e->isChord () && toChord (e)->slash ()) {
452+ offsetVoices = false ;
453+ break ;
454+ }
455+ }
456+ }
457+
446458 if (offsetVoices && staff ()->mergeMatchingRests ()) {
447- // automatically merge matching rests in voices 1 & 2 if nothing in any other voice
459+ // automatically merge matching rests if nothing in any other voice
448460 // this is not always the right thing to do do, but is useful in choral music
449- // and perhaps could be made enabled via a staff property
450- // so choral staves can be treated differently than others
461+ // and can be enabled via a staff property
451462 bool matchFound = false ;
452- bool nothingElse = true ;
453463 int baseTrack = staffIdx () * VOICES;
454464 for (int v = 0 ; v < VOICES; ++v) {
455465 if (v == voice ()) {
456466 continue ;
457467 }
458468 Element* e = s->element (baseTrack + v);
459- if (v <= 1 ) {
460- // try to find match in other voice (1 or 2)
461- if (e && e ->type () == ElementType::REST) {
469+ // try to find match in any other voice
470+ if (e) {
471+ if (e->type () == ElementType::REST) {
462472 Rest* r = toRest (e);
463473 if (r->globalTicks () == globalTicks ()) {
464474 matchFound = true ;
465475 continue ;
466476 }
467477 }
468478 // no match found; no sense looking for anything else
479+ matchFound = false ;
469480 break ;
470- } else {
471- // if anything in another voice, do not merge
472- if (e) {
473- nothingElse = false ;
474- break ;
475- }
476481 }
477482 }
478- if (matchFound && nothingElse ) {
483+ if (matchFound) {
479484 offsetVoices = false ;
480485 }
481486 }
@@ -494,8 +499,9 @@ int Rest::computeLineOffset(int lines)
494499 // Ignore stems and articulations, because which multi-voice they are at the opposite end.
495500 int upOffset = up ? 1 : 0 ;
496501 int line = up ? 10 : -10 ;
502+
497503 // For compatibility reasons apply automatic collision avoidance only if y-offset is unchanged
498- if (qFuzzyIsNull (offset ().y ())) {
504+ if (qFuzzyIsNull (offset ().y ()) && autoplace () ) {
499505 int firstTrack = staffIdx () * 4 ;
500506 int extraOffsetForFewLines = lines < 5 ? 2 : 0 ;
501507 bool isMeasureRest = durationType ().type () == TDuration::DurationType::V_MEASURE;
0 commit comments