void PianorollEditor::tickLenChanged(int val) { QList<QGraphicsItem*> items = gv->scene()->selectedItems(); if (items.size() != 1) return; QGraphicsItem* item = items[0]; if (item->type() != PianoItemType) return; PianoItem* pi = static_cast<PianoItem*>(item); Note* note = pi->note(); NoteEvent* event = pi->event(); if (event->len() == val) return; NoteEvent ne = *event; ne.setLen(val); _score->startCmd(); _score->undo(new ChangeNoteEvent(note, event, ne)); _score->endCmd(); }
void PianorollEditor::updateSelection() { QList<QGraphicsItem*> items = gv->scene()->selectedItems(); if (items.size() == 1) { PianoItem* item = static_cast<PianoItem*>(items[0]); if (item->type() == PianoItemType) { Note* note = item->note(); NoteEvent* event = item->event(); pitch->setEnabled(true); pitch->setValue(note->pitch()); onTime->setValue(event->ontime()); tickLen->setValue(event->len()); updateVelocity(note); } } bool b = items.size() != 0; velocity->setEnabled(b); pitch->setEnabled(b); veloType->setEnabled(b); onTime->setEnabled(b); tickLen->setEnabled(b); }