diff --git a/mscore/exportxml.cpp b/mscore/exportxml.cpp index a1b187a1a5..199bef2ac4 100644 --- a/mscore/exportxml.cpp +++ b/mscore/exportxml.cpp @@ -233,7 +233,7 @@ class SlurHandler { public: SlurHandler(); - void doSlurStart(Chord* chord, Notations& notations, Xml& xml); + void doSlurStart(Chord* chord, Notations& notations, Xml& xml, bool grace = false); void doSlurStop(Chord* chord, Notations& notations, Xml& xml); }; @@ -445,8 +445,28 @@ int SlurHandler::findSlur(const Slur* s) const // doSlurStart //--------------------------------------------------------- -void SlurHandler::doSlurStart(Chord* chord, Notations& notations, Xml& xml) +void SlurHandler::doSlurStart(Chord* chord, Notations& notations, Xml& xml, bool grace) { + // slurs on grace notes are not in spanner list, therefore: + if (grace){ + foreach(Element* el, chord->el()){ + if (el->type() == Element::SLUR){ + const Slur* s = static_cast(el); + //define line type + QString rest = slurTieLineStyle(s); + int i = findSlur(0); + if (i >= 0) { + slur[i] = s; + started[i] = true; + notations.tag(xml); + xml.tagE(QString("slur%1 type=\"start\" number=\"%2\"").arg(rest).arg(i + 1)); + } + else + qDebug("no free slur slot"); + } + } + return; + } // search for slur(s) starting at this chord int tick = chord->tick(); auto sl = chord->score()->spanner(); @@ -2309,9 +2329,11 @@ void ExportMusicXml::chord(Chord* chord, int staff, const QList* ll, bo } if (note == nl.front()) { - tupletStartStop(chord, notations, xml); - if (!grace) { - // handle slurs between normal (non-grace) notes + if (grace){ + sh.doSlurStart(chord, notations, xml, true); + } + else { + tupletStartStop(chord, notations, xml); sh.doSlurStop(chord, notations, xml); sh.doSlurStart(chord, notations, xml); } diff --git a/mscore/importxml.cpp b/mscore/importxml.cpp index eb24f0e866..a43bac4165 100644 --- a/mscore/importxml.cpp +++ b/mscore/importxml.cpp @@ -4153,6 +4153,10 @@ void MusicXml::xmlNotations(Note* note, ChordRest* cr, int trk, int ticks, QDomE bool endSlur = false; if (slur[slurNo] == 0) { slur[slurNo] = new Slur(score); + if(cr->isGrace()){ + slur[slurNo]->setAnchor(Spanner::ANCHOR_CHORD); + slur[slurNo]->setParent(cr); + } if (lineType == "dotted") slur[slurNo]->setLineType(1); else if (lineType == "dashed") diff --git a/mscore/scoreview.cpp b/mscore/scoreview.cpp index 59c9a713c0..fd06f4624e 100644 --- a/mscore/scoreview.cpp +++ b/mscore/scoreview.cpp @@ -4105,6 +4105,8 @@ void ScoreView::cmdAddSlur(Note* firstNote, Note* lastNote) slur->setStartChord(static_cast(cr1)); slur->setEndChord(static_cast(cr2)); + slur->setTick(cr1->tick()); + slur->setTick2(cr2->tick()); slur->setTrack(cr1->track()); slur->setTrack2(cr2->track()); slur->setParent(cr1);