From 6d2225bf2af1fef7c7d183120db456e5e8ab0541 Mon Sep 17 00:00:00 2001 From: ws Date: Thu, 31 Jul 2014 13:33:50 +0200 Subject: [PATCH] fix #26546 --- libmscore/line.cpp | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/libmscore/line.cpp b/libmscore/line.cpp index cafdd56d5330d..7a903ad966dcb 100644 --- a/libmscore/line.cpp +++ b/libmscore/line.cpp @@ -441,24 +441,28 @@ SLine::SLine(const SLine& s) QPointF SLine::linePos(GripLine grip, System** sys) { - qreal _spatium = spatium(); qreal x = 0.0; switch (anchor()) { case Spanner::Anchor::SEGMENT: { - Measure* m; - int t; + ChordRest* cr; if (grip == GripLine::START) - t = tick(); + cr = static_cast(startElement()); + else { + cr = static_cast(endElement()); + if (cr) + x += cr->width(); + } + + int t = grip == GripLine::START ? tick() : tick2(); + Measure* m = cr ? cr->measure() : score()->tick2measure(t); + + if (m) { + x += cr ? cr->pos().x() + cr->segment()->pos().x() + m->pos().x() : m->tick2pos(t); + *sys = m->system(); + } else - t = tick2() - 1; - m = score()->tick2measure(t); - if (!m) { *sys = 0; - break; - } - x += m->tick2pos(t); - *sys = m->system(); } break; @@ -475,6 +479,8 @@ QPointF SLine::linePos(GripLine grip, System** sys) } } else { + qreal _spatium = spatium(); + Q_ASSERT(endElement()->type() == Element::Type::MEASURE); m = static_cast(endElement()); x = m->pos().x() + m->bbox().right();