From 5a16cb219b48edada836e774c357f9daac3096c5 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 | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/libmscore/edit.cpp b/libmscore/edit.cpp index 8becba145cb56..9e35a4202458e 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) { + auto el = score()->selection().firstChordRest(); + auto selectTrack = el ? el->track() : 0; + auto selectTick = el ? el->tick() : Fraction(0,1); + deselectAll(); if (fm->isMMRest()) @@ -911,6 +915,17 @@ void Score::cmdAddTimeSig(Measure* fm, int staffIdx, TimeSig* ts, bool local) } } delete ts; + + // Attempt valid selection afterward: + if (el) { + if (auto msr = score()->tick2measure(selectTick)) { + if (auto first = msr->first()) { + if (auto cr = first->nextChordRest(selectTrack)) { + if (cr->isChord()) + score()->select(toChord(cr)->upNote()); + else + score()->select(cr); + }}}} } //---------------------------------------------------------