Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #299214: Reimplement Shift+L/R for leading space while in edit mode upon notehead #6204

Merged
merged 1 commit into from
Jun 22, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 8 additions & 10 deletions libmscore/note.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2504,8 +2504,13 @@ void Note::endDrag(EditData& ed)
void Note::editDrag(EditData& editData)
{
Chord* ch = chord();
Segment* seg = ch->segment();

if (ch->notes().size() == 1) {
if (editData.modifiers & Qt::ShiftModifier) {
const Spatium deltaSp = Spatium(editData.delta.x() / spatium());
seg->undoChangeProperty(Pid::LEADING_SPACE, seg->extraLeadingSpace() + deltaSp);
}
else if (ch->notes().size() == 1) {
// if the chord contains only this note, then move the whole chord
// including stem, flag etc.
ch->undoChangeProperty(Pid::OFFSET, ch->offset() + offset() + editData.evtDelta);
Expand Down Expand Up @@ -2616,15 +2621,8 @@ void Note::horizontalDrag(EditData &ed)

NoteEditData* ned = static_cast<NoteEditData*>(ed.getData(this));

// adjust segment on plain drag or Shift+cursor,
// adjust note/chord for Ctrl+drag or plain cursor
if (seg &&
(((ed.buttons & Qt::LeftButton) && !(ed.modifiers & Qt::ControlModifier))
|| (ed.modifiers & Qt::ShiftModifier))) {

if (ed.moveDelta.x() < 0)
normalizeLeftDragDelta(seg, ed, ned);
}
if (ed.moveDelta.x() < 0)
normalizeLeftDragDelta(seg, ed, ned);

const Spatium deltaSp = Spatium(ned->delta.x() / spatium());

Expand Down
18 changes: 18 additions & 0 deletions libmscore/rest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1164,4 +1164,22 @@ Shape Rest::shape() const
return shape;
}

//---------------------------------------------------------
// editDrag
//---------------------------------------------------------

void Rest::editDrag(EditData& editData)
{
Segment* seg = segment();

if (editData.modifiers & Qt::ShiftModifier) {
const Spatium deltaSp = Spatium(editData.delta.x() / spatium());
seg->undoChangeProperty(Pid::LEADING_SPACE, seg->extraLeadingSpace() + deltaSp);
}
else {
setOffset(offset() + editData.evtDelta);
}
triggerLayout();
}

}
1 change: 1 addition & 0 deletions libmscore/rest.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ class Rest : public ChordRest {
QString accessibleInfo() const override;
QString screenReaderInfo() const override;
Shape shape() const override;
void editDrag(EditData& editData) override;
};

} // namespace Ms
Expand Down