From 2d7993bb8db0e01c331230d3dd35139415963092 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 | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/libmscore/edit.cpp b/libmscore/edit.cpp index 8becba145cb56..25da8cebf5f69 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,15 @@ 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)) { + if (cr->isChord()) + score()->select(toChord(cr)->upNote()); + else score()->select(cr); + }}} } //---------------------------------------------------------