From e4151650e6ada3c793f2badca3be692bcc5646fe Mon Sep 17 00:00:00 2001 From: "J.G" Date: Thu, 3 Oct 2024 06:09:02 +0000 Subject: [PATCH] Palette: Time Signatures applied will result in a valid ChordRest selection --- libmscore/edit.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/libmscore/edit.cpp b/libmscore/edit.cpp index 8becba145cb56..0ff5a7c9c16a5 100644 --- a/libmscore/edit.cpp +++ b/libmscore/edit.cpp @@ -739,6 +739,10 @@ bool Score::rewriteMeasures(Measure* fm, const Fraction& ns, int staffIdx) void Score::cmdAddTimeSig(Measure* fm, int staffIdx, TimeSig* ts, bool local) { + if (!score()->selection().firstChordRest()) + return; + auto selectTrack = score()->selection().firstChordRest()->track(); + auto selectTick = score()->selection().firstChordRest()->tick(); deselectAll(); if (fm->isMMRest()) @@ -911,6 +915,13 @@ void Score::cmdAddTimeSig(Measure* fm, int staffIdx, TimeSig* ts, bool local) } } delete ts; + + // Attempt valid selection afterward: + if (auto msr = score()->tick2measure(selectTick)) { + if (auto first = msr->first()) { + if (auto cr = first->nextChordRest(selectTrack)) { + score()->select(cr->isChord() ? toChord(cr)->upNote() : cr); + }}} } //---------------------------------------------------------