Skip to content

Commit 1a5940f

Browse files
author
dylan.nicholson
committed
Fix https://musescore.org/en/node/324626 - linked dynamics not saving
properly
1 parent 1d14b03 commit 1a5940f

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/engraving/libmscore/dynamic.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -420,8 +420,11 @@ void Dynamic::startEdit(EditData& ed)
420420
void Dynamic::endEdit(EditData& ed)
421421
{
422422
TextBase::endEdit(ed);
423-
if (xmlText() != QString::fromUtf8(dynList[int(_dynamicType)].text)) {
424-
_dynamicType = Type::OTHER;
423+
auto text = xmlText();
424+
auto it = std::find_if(std::begin(dynList), std::end(dynList), [text](const Ms::Dyn& d) { return text == QString::fromUtf8(d.text); });
425+
_dynamicType = it == std::end(dynList) ? Type::OTHER : static_cast<Type>(it - std::begin(dynList));
426+
for (auto* e : this->linkList()) {
427+
toDynamic(e)->_dynamicType = _dynamicType;
425428
}
426429
}
427430

0 commit comments

Comments
 (0)