Skip to content

Commit 0386b95

Browse files
iveshenry18vpereverzev
authored andcommitted
ENG-54: Check spanners when assessing emptiness
Previously, a staff's emptiness was calculated based on its note and annotation content. Since this is evaluated before the system was laid out, the system did not have pointers to its SpannerSegments. This commit adds a way to include whether a staff has any spanners (particularly pedal markings and hanging slurs) in assessing emptiness, creating more consistent/expected hiding behavior in HideMode::AUTO.
1 parent 8d2a28b commit 0386b95

File tree

2 files changed

+1548
-0
lines changed

2 files changed

+1548
-0
lines changed

libmscore/layout.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1328,6 +1328,10 @@ void Score::hideEmptyStaves(System* system, bool isFirstSystem)
13281328
int staffIdx = 0;
13291329
bool systemIsEmpty = true;
13301330

1331+
Fraction stick = system->measures().front()->tick();
1332+
Fraction etick = system->measures().back()->endTick();
1333+
auto spanners = score()->spannerMap().findOverlapping(stick.ticks(), etick.ticks());
1334+
13311335
for (Staff* staff : qAsConst(_staves)) {
13321336
SysStaff* ss = system->staff(staffIdx);
13331337

@@ -1339,6 +1343,12 @@ void Score::hideEmptyStaves(System* system, bool isFirstSystem)
13391343
&& !(isFirstSystem && styleB(Sid::dontHideStavesInFirstSystem))
13401344
&& hideMode != Staff::HideMode::NEVER)) {
13411345
bool hideStaff = true;
1346+
for (auto spanner : spanners) {
1347+
if (spanner.value->staff() == staff) {
1348+
hideStaff = false;
1349+
break;
1350+
}
1351+
}
13421352
for (MeasureBase* m : system->measures()) {
13431353
if (!m->isMeasure())
13441354
continue;

0 commit comments

Comments
 (0)