Element* KeySig::drop(const DropData& data) { KeySig* ks = static_cast<KeySig*>(data.element); if (ks->type() != Element::Type::KEYSIG) { delete ks; return 0; } KeySigEvent k = ks->keySigEvent(); delete ks; if (data.modifiers & Qt::ControlModifier) { // apply only to this stave if (!(k == keySigEvent())) score()->undoChangeKeySig(staff(), tick(), k); } else { // apply to all staves: foreach(Staff* s, score()->rootScore()->staves()) score()->undoChangeKeySig(s, tick(), k); } return this; }