Skip to content

Commit

Permalink
Merge pull request #23895 from Nekotizimo/21572-color-beamed-chord
Browse files Browse the repository at this point in the history
Fix #21572: Changing color of beamed chords should only change the elements within selection
  • Loading branch information
mike-spa authored Aug 12, 2024
2 parents 101db16 + 5068d57 commit c510289
Showing 1 changed file with 21 additions and 8 deletions.
29 changes: 21 additions & 8 deletions src/inspector/internal/services/elementrepositoryservice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,14 +160,6 @@ const
}

resultList << element;

if (elementType == mu::engraving::ElementType::BEAM) {
const mu::engraving::Beam* beam = mu::engraving::toBeam(element);

for (mu::engraving::ChordRest* chordRest : beam->elements()) {
resultList << chordRest;
}
}
}

return resultList;
Expand All @@ -183,6 +175,18 @@ QList<mu::engraving::EngravingItem*> ElementRepositoryService::findChords() cons
continue;
}

if (element->type() == mu::engraving::ElementType::BEAM) {
const mu::engraving::Beam* beam = mu::engraving::toBeam(element);

for (mu::engraving::ChordRest* chordRest : beam->elements()) {
if (!chordRest->isChord()) {
continue;
}
elements << chordRest;
}
continue;
}

mu::engraving::EngravingItem* chord = element->findAncestor(mu::engraving::ElementType::CHORD);
if (chord) {
elements << chord;
Expand Down Expand Up @@ -407,6 +411,15 @@ QList<mu::engraving::EngravingItem*> ElementRepositoryService::findRests() const
for (mu::engraving::EngravingItem* element : m_exposedElementList) {
if (element->isRest()) {
resultList << element;
} else if (element->isBeam()) {
const mu::engraving::Beam* beam = mu::engraving::toBeam(element);

for (mu::engraving::ChordRest* chordRest : beam->elements()) {
if (!chordRest->isRest()) {
continue;
}
resultList << chordRest;
}
}
}

Expand Down

0 comments on commit c510289

Please sign in to comment.