From 12aea7d6c74de79d7fbcaac6641ab09cbaecb0fa Mon Sep 17 00:00:00 2001 From: iveshenry18 Date: Mon, 5 Jul 2021 23:30:30 -0600 Subject: [PATCH] Tweak MusicXML tempo inference logic This commit changes the method by which Staff Text is checked for boldness, using a slightly more robust regex. Duplicate of #8412, part 5 --- importexport/musicxml/importmxmlpass2.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/importexport/musicxml/importmxmlpass2.cpp b/importexport/musicxml/importmxmlpass2.cpp index 51d24baadc0dd..200c29b8d53cc 100644 --- a/importexport/musicxml/importmxmlpass2.cpp +++ b/importexport/musicxml/importmxmlpass2.cpp @@ -2610,7 +2610,7 @@ bool MusicXMLDelayedDirectionElement::isTempoOrphanCandidate() const { return _element->isStaffText() && _placement == "above" - && toStaffText(_element)->xmlText().contains(""); + && toStaffText(_element)->xmlText().contains(QRegularExpression("^(<.*/>)*.*$")); } //--------------------------------------------------------- @@ -3379,11 +3379,12 @@ bool MusicXMLParserDirection::attemptTempoTextCoercion(const Fraction& tick) _tpoSound = tempoVal / noteVal; return true; } - else if (placement() == "above" && _wordsText.contains("")) + else if (placement() == "above" && _wordsText.contains(QRegularExpression("^(<.*/>)*.*$"))) { if (tick == Fraction(0, 1)) return true; for (auto tempoWord : tempoWords) if (_wordsText.contains(tempoWord, Qt::CaseInsensitive)) return true; + } return false; }