From bdba1501dbc65dc945dc7fc0e297d65db356fcbb Mon Sep 17 00:00:00 2001 From: Joachim Schmitz Date: Sun, 29 Sep 2024 14:26:05 +0200 Subject: [PATCH 1/2] Fix Cubase XML chord symbol import Follow up to #24915 --- .../musicxml/internal/musicxml/importmxmlpass2.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/importexport/musicxml/internal/musicxml/importmxmlpass2.cpp b/src/importexport/musicxml/internal/musicxml/importmxmlpass2.cpp index 4b566615b36fc..f1dc6d73ca688 100644 --- a/src/importexport/musicxml/internal/musicxml/importmxmlpass2.cpp +++ b/src/importexport/musicxml/internal/musicxml/importmxmlpass2.cpp @@ -7434,7 +7434,8 @@ void MusicXMLParserPass2::harmony(const String& partId, Measure* measure, const } else if (m_e.name() == "bass-alter") { // attributes: print-object, print-style // location (left-right) - alter = m_e.readInt(); + // Cubase exports this value with a trailing newline + alter = m_e.readText().simplified().toInt(); } else { skipLogCurrElem(); } From d98d7c4257d80b03d595ac76f140e2056045f736 Mon Sep 17 00:00:00 2001 From: Joachim Schmitz Date: Sun, 29 Sep 2024 21:22:07 +0200 Subject: [PATCH 2/2] Use `trimmed()` where needed --- .../musicxml/internal/musicxml/importmxmlpass2.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/importexport/musicxml/internal/musicxml/importmxmlpass2.cpp b/src/importexport/musicxml/internal/musicxml/importmxmlpass2.cpp index f1dc6d73ca688..b38f77b75ccfb 100644 --- a/src/importexport/musicxml/internal/musicxml/importmxmlpass2.cpp +++ b/src/importexport/musicxml/internal/musicxml/importmxmlpass2.cpp @@ -3083,7 +3083,7 @@ void MusicXMLParserPass2::staffTuning(StringData* t) int octave = 0; while (m_e.readNextStartElement()) { if (m_e.name() == "tuning-alter") { - alter = m_e.readInt(); + alter = m_e.readText().trimmed().toInt(); } else if (m_e.name() == "tuning-octave") { octave = m_e.readInt(); } else if (m_e.name() == "tuning-step") { @@ -5704,7 +5704,7 @@ void MusicXMLParserPass2::key(const String& partId, Measure* measure, const Frac flushAlteredTone(key, keyStep, keyAlter, keyAccidental, smufl); keyStep = m_e.readText(); } else if (m_e.name() == "key-alter") { - keyAlter = m_e.readText(); + keyAlter = m_e.readText().trimmed(); } else if (m_e.name() == "key-accidental") { smufl = m_e.attribute("smufl"); keyAccidental = m_e.readText(); @@ -7391,8 +7391,7 @@ void MusicXMLParserPass2::harmony(const String& partId, Measure* measure, const } else if (m_e.name() == "root-alter") { // attributes: print-object, print-style // location (left-right) - // Cubase exports this value with a trailing newline - alter = m_e.readText().simplified().toInt(); + alter = m_e.readText().trimmed().toInt(); } else { skipLogCurrElem(); } @@ -7434,8 +7433,7 @@ void MusicXMLParserPass2::harmony(const String& partId, Measure* measure, const } else if (m_e.name() == "bass-alter") { // attributes: print-object, print-style // location (left-right) - // Cubase exports this value with a trailing newline - alter = m_e.readText().simplified().toInt(); + alter = m_e.readText().trimmed().toInt(); } else { skipLogCurrElem(); } @@ -7449,7 +7447,7 @@ void MusicXMLParserPass2::harmony(const String& partId, Measure* measure, const if (m_e.name() == "degree-value") { degreeValue = m_e.readInt(); } else if (m_e.name() == "degree-alter") { - degreeAlter = m_e.readInt(); + degreeAlter = m_e.readText().trimmed().toInt(); } else if (m_e.name() == "degree-type") { degreeType = m_e.readText(); } else {