How do I figure out the measure number of a Measure, Element, Segment or Cursor?
I might be missing something, but I can't see any obvious way of determining the measure number from a given Measure, Element, Segment or Cursor. None of them has a 'measureNumber' property, which would be extremely useful. The only way I can think of to do it would be to iterate through all the measures in the score, calculating their total ticks, until I reach the tick of the object I'm currently at, which seems laborious.
Any tricks?
Comments
Iterating a map of the score is a very fast process and quite simple. It is also very easy to count measures in a simple loop. There are probably many better plugins that show how to do so but you may be able to use the simple TAB Walk plugin as an example.
See https://musescore.org/en/project/tab-walk
and https://github.com/yonah-ag/musescore-tab-walk/blob/main/TabWalk.qml
There may be a more direct method that someone else knows of.