Skip to content

Commit

Permalink
ENG-41: Add space between tempo text and metro
Browse files Browse the repository at this point in the history
Add logic to add a space between the words and the metronome marking,
if there isn't already a space present at the end of the words.

Duplicate of musescore#8284, plus a fix to make it compatible with Qt 5.9 again, see also musescore#8554
  • Loading branch information
iveshenry18 authored and Jojo-Schmitz committed Sep 23, 2021
1 parent a34d289 commit f7e7d9b
Show file tree
Hide file tree
Showing 6 changed files with 2,720 additions and 1 deletion.
9 changes: 8 additions & 1 deletion importexport/musicxml/importmxmlpass2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2498,7 +2498,14 @@ void MusicXMLParserDirection::direction(const QString& partId,
else {
_tpoSound /= 60;
t = new TempoText(_score);
t->setXmlText(_wordsText + _metroText);
QString rawWordsText = _wordsText;
rawWordsText.remove(QRegularExpression("(<.*?>)"));
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
QString sep = _metroText != "" && _wordsText != "" && rawWordsText.back() != ' ' ? " " : "";
#else
QString sep = _metroText != "" && _wordsText != "" && rawWordsText.at(rawWordsText.size() - 1) != ' ' ? " " : "";
#endif
t->setXmlText(_wordsText + sep + _metroText);
((TempoText*) t)->setTempo(_tpoSound);
((TempoText*) t)->setFollowText(true);
_score->setTempo(tick, _tpoSound);
Expand Down

0 comments on commit f7e7d9b

Please sign in to comment.