Skip to content

Commit 314a7fe

Browse files
asattelyJojo-Schmitz
authored andcommitted
Bare min. from PR#9068 to be able to port PR#9137 to 3.x
(Very partial) backport of musescore#9068, the rest is too large for too litle benefit (mainly due to the missing UI) and also requires C++17.
1 parent dc2675b commit 314a7fe

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

libmscore/measure.cpp

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4596,4 +4596,26 @@ void Measure::computeMinWidth()
45964596
computeMinWidth(s, x, isSystemHeader);
45974597
}
45984598

4599+
qreal Measure::computeFirstSegmentXPosition(Segment* segment)
4600+
{
4601+
qreal x = 0;
4602+
4603+
Shape ls(QRectF(0.0, 0.0, 0.0, spatium() * 4));
4604+
4605+
x = segment->minLeft(ls);
4606+
4607+
if (segment->isChordRestType())
4608+
x += score()->styleP(hasAccidental(segment) ? Sid::barAccidentalDistance : Sid::barNoteDistance);
4609+
else if (segment->isClefType() || segment->isHeaderClefType())
4610+
x += score()->styleP(Sid::clefLeftMargin);
4611+
else if (segment->isKeySigType())
4612+
x = qMax(x, score()->styleP(Sid::keysigLeftMargin));
4613+
else if (segment->isTimeSigType())
4614+
x = qMax(x, score()->styleP(Sid::timesigLeftMargin));
4615+
4616+
x += segment->extraLeadingSpace().val() * spatium();
4617+
4618+
return x;
4619+
}
4620+
45994621
}

libmscore/measure.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,9 @@ class Measure final : public MeasureBase {
279279
void checkTrailer();
280280
void setStretchedWidth(qreal);
281281
void layoutStaffLines();
282+
283+
qreal computeFirstSegmentXPosition(Segment* segment);
284+
282285
};
283286

284287
} // namespace Ms

0 commit comments

Comments
 (0)