Skip to content

Commit

Permalink
fix #304057: fixed harmony being reset when loading
Browse files Browse the repository at this point in the history
Manually rebased #5967 on 3.x
  • Loading branch information
SKefalidis authored and anatoly-os committed Jun 6, 2020
1 parent 3419430 commit c5be9ad
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
22 changes: 20 additions & 2 deletions libmscore/fret.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -814,7 +814,7 @@ void FretDiagram::read(XmlReader& e)
else if (tag == "Harmony") {
Harmony* h = new Harmony(score());
h->read(e);
add(h);
addLoaded(h);
}
else if (!Element::readProperties(e))
e.unknown();
Expand Down Expand Up @@ -1199,8 +1199,26 @@ void FretDiagram::add(Element* e)
_harmony->setProperty(Pid::ALIGN, int(Align::HCENTER | Align::TOP));
_harmony->setPropertyFlags(Pid::ALIGN, PropertyFlags::UNSTYLED);
}
else
else {
qWarning("FretDiagram: cannot add <%s>\n", e->name());
}
}

//---------------------------------------------------------
// addLoaded
// used to add harmonies in read()
//---------------------------------------------------------

void FretDiagram::addLoaded(Element* e)
{
e->setParent(this);
if (e->isHarmony()) {
_harmony = toHarmony(e);
_harmony->setTrack(track());
}
else {
qWarning("FretDiagram: cannot add <%s>\n", e->name());
}
}

//---------------------------------------------------------
Expand Down
1 change: 1 addition & 0 deletions libmscore/fret.h
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ class FretDiagram final : public Element {
void init(Ms::StringData*, Chord*);

void add(Element*) override;
void addLoaded(Element*);
void remove(Element*) override;

bool acceptDrop(EditData&) const override;
Expand Down

0 comments on commit c5be9ad

Please sign in to comment.