Skip to content

Commit

Permalink
Fix GH#22098: staff distance with hidden staves
Browse files Browse the repository at this point in the history
Backport of musescore#25960
  • Loading branch information
rettinghaus authored and Jojo-Schmitz committed Jan 1, 2025
1 parent 3eabcf0 commit 1173aef
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions importexport/musicxml/exportxml.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6549,15 +6549,19 @@ void ExportMusicXml::print(const Measure* const m, const int partNr, const int f

// Staff layout elements.
for (int staffIdx = (firstStaffOfPart == 0) ? 1 : 0; staffIdx < nrStavesInPart; staffIdx++) {

// calculate distance between this and previous staff using the bounding boxes
const int staffNr = firstStaffOfPart + staffIdx;
const QRectF& prevBbox = system->staff(staffNr - 1)->bbox();
const int prevStaffNr = system->prevVisibleStaff(staffNr);
if (prevStaffNr == -1)
continue;
const QRectF& prevBbox = system->staff(prevStaffNr)->bbox();
const qreal staffDist = system->staff(staffNr)->bbox().y() - prevBbox.y() - prevBbox.height();

_xml.stag(QString("staff-layout number=\"%1\"").arg(staffIdx + 1));
_xml.tag("staff-distance", QString("%1").arg(QString::number(getTenthsFromDots(staffDist),'f',2)));
_xml.etag();
if (staffDist > 0) {
_xml.stag(QString("staff-layout number=\"%1\"").arg(staffIdx + 1));
_xml.tag("staff-distance", QString("%1").arg(QString::number(getTenthsFromDots(staffDist),'f',2)));
_xml.etag();
}
}

_xml.etag();
Expand Down

0 comments on commit 1173aef

Please sign in to comment.