Text placement and skipping of tied notes
Dear all,
I wrote a little macro to display some fingerings as a text. The text should be displayed below the stave. However, I have two problems:
- For every text item, the box "Automatic placement" is ticked on. I want to tick it off in my macro and use more a fixed position of the text
- The text should not be displayed for tied notes, but I don't know how to do this in a macro
Your help is very much appreciated!
Thanks, Philipp
Attachment | Size |
---|---|
FlötenGriffe.qml | 7.79 KB |
Comments
not sure about tied notes but there's a boolean attribute
autoplace
you can use like:I guess it must be true by default.
In reply to nnot sure about tied notes… by billhails
Ok thanks, this worked out!
For detecting/skipping notes based on ties, starting with 3.3:
/// Backward tie for this Note.
/// \since MuseScore 3.3
Q_PROPERTY(Ms::PluginAPI::Tie* tieBack READ tieBack)
/// Forward tie for this Note.
/// \since MuseScore 3.3
Q_PROPERTY(Ms::PluginAPI::Tie* tieForward READ tieForward)
/// The first note of a series of ties to this note.
/// This will return the calling note if there is not tieBack.
/// \since MuseScore 3.3
Q_PROPERTY(Ms::PluginAPI::Note* firstTiedNote READ firstTiedNote)
/// The last note of a series of ties to this note.
/// This will return the calling note if there is not tieForward.
/// \since MuseScore 3.3
Q_PROPERTY(Ms::PluginAPI::Note* lastTiedNote READ lastTiedNote)
In reply to For detecting/skipping notes… by jeetee
Ok, but I have no idea how to use this in my macro... Could you please help me? Thanks!
In reply to Ok, but I have no idea how… by Philipp König
replace
if (!cursor.element || cursor.element.type != Element.CHORD) {
with something such as
If the text should be displayed below the staff, setting its
placement
property may be better than disabling autoplacement for it:text.placement = Placement.BELOW
Actually I would recommend to set
placement
property correctly even if disabling autoplacement for an element, this can potentially make calculating positions easier and is generally more likely to work better across different scores and MuseScore versions. Still that is not strictly necessary.