Merge pull request #11558 from HemantAntony/11502-change_instrument_always_applied
Fix #11502: Change instrument always applied
This commit is contained in:
commit
59e9c6dfa3
2 changed files with 15 additions and 6 deletions
|
@ -1316,7 +1316,11 @@ bool NotationInteraction::drop(const PointF& pos, Qt::KeyboardModifiers modifier
|
|||
|
||||
EngravingItem* dropElement = el->drop(m_dropData.ed);
|
||||
if (dropElement && dropElement->isInstrumentChange()) {
|
||||
selectInstrument(toInstrumentChange(dropElement));
|
||||
if (!selectInstrument(toInstrumentChange(dropElement))) {
|
||||
rollback();
|
||||
accepted = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
score()->addRefresh(el->canvasBoundingRect());
|
||||
if (dropElement) {
|
||||
|
@ -1356,19 +1360,21 @@ bool NotationInteraction::drop(const PointF& pos, Qt::KeyboardModifiers modifier
|
|||
return accepted;
|
||||
}
|
||||
|
||||
void NotationInteraction::selectInstrument(Ms::InstrumentChange* instrumentChange)
|
||||
bool NotationInteraction::selectInstrument(Ms::InstrumentChange* instrumentChange)
|
||||
{
|
||||
if (!instrumentChange) {
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
RetVal<Instrument> selectedInstrument = selectInstrumentScenario()->selectInstrument();
|
||||
if (!selectedInstrument.ret) {
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
instrumentChange->setInit(true);
|
||||
instrumentChange->setupInstrument(&selectedInstrument.val);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//! NOTE Copied from Palette::applyPaletteElement
|
||||
|
@ -1719,7 +1725,10 @@ void NotationInteraction::applyDropPaletteElement(Ms::Score* score, Ms::Engravin
|
|||
|
||||
Ms::EngravingItem* el = target->drop(*dropData);
|
||||
if (el && el->isInstrumentChange()) {
|
||||
selectInstrument(toInstrumentChange(el));
|
||||
if (!selectInstrument(toInstrumentChange(el))) {
|
||||
rollback();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (el && !score->inputState().noteEntryMode()) {
|
||||
|
|
|
@ -322,7 +322,7 @@ private:
|
|||
bool dropCanvas(EngravingItem* e);
|
||||
void resetDropElement();
|
||||
|
||||
void selectInstrument(Ms::InstrumentChange* instrumentChange);
|
||||
bool selectInstrument(Ms::InstrumentChange* instrumentChange);
|
||||
|
||||
void applyDropPaletteElement(Ms::Score* score, Ms::EngravingItem* target, Ms::EngravingItem* e, Qt::KeyboardModifiers modifiers,
|
||||
PointF pt = PointF(), bool pasteMode = false);
|
||||
|
|
Loading…
Reference in a new issue