File tree Expand file tree Collapse file tree 1 file changed +13
-3
lines changed
src/instrumentsscene/internal Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -60,12 +60,22 @@ void InstrumentsActionsController::changeInstrument()
6060 return ;
6161 }
6262
63- const mu::engraving::EngravingItem* element = master->notation ()->interaction ()->selection ()->element ();
64- const mu::engraving::InstrumentChange* instrumentChange = element ? mu::engraving::toInstrumentChange (element) : nullptr ;
65- if (!instrumentChange) {
63+ INotationPtr notation = context ()->currentNotation ();
64+ IF_ASSERT_FAILED (notation) {
6665 return ;
6766 }
6867
68+ const mu::engraving::EngravingItem* element = notation->interaction ()->hitElementContext ().element ;
69+ if (!element) {
70+ element = notation->interaction ()->selection ()->element ();
71+ }
72+
73+ if (!element || !element->isInstrumentChange ()) {
74+ return ;
75+ }
76+
77+ const mu::engraving::InstrumentChange* instrumentChange = mu::engraving::toInstrumentChange (element);
78+
6979 InstrumentKey key;
7080 key.instrumentId = instrumentChange->instrument ()->id ();
7181 key.partId = instrumentChange->part ()->id ();
You can’t perform that action at this time.
0 commit comments