MuseScore Plugins 3.2.3
Plugins API for MuseScore
Porting MuseScore 2 plugins

This page describes changes between MuseScore 2.X and MuseScore 3 plugins API.

Import statement

Replace import MuseScore 1.0 with import MuseScore 3.0 to start porting a 2.X plugin. This is needed to distinguish between plugins for different MuseScore versions.

If your plugin uses FileIO API, replace also import FileIO 1.0 with import FileIO 3.0.

Properties assignments

Most of properties should remain the same as in MuseScore 2.X. Most notable differences:

  • TimeSig doesn't have setSig() function anymore.
    Replace
    ts.setSig(numerator, denominator)
    with
    ts.timesig = fraction(numerator, denominator)
  • No pos property available.
    Autoplacement engine makes it not necessary to adjust elements position in most cases. If this is still needed, use offset or offsetX and offsetY properties to adjust position offset:
    element.offset = Qt.point(x, y);
    or
    element.offsetX = x;
    element.offsetY = y;
    where x, y are arbitrary numbers (in spatium units).

Enumerations

Most of enumerations exposed to QML plugins remain the same but some were renamed compared to MuseScore 2.X API. The renamed enumerations include:

  • Placement — element placement above or below staff
    Element.ABOVE, Element.BELOWPlacement.ABOVE, Placement.BELOW
  • Direction — vertical direction
    MScore.UP, MScore.DOWN, MScore.AUTODirection.UP, Direction.DOWN, Direction.AUTO
  • DirectionH — horizontal direction
    MScore.LEFT, MScore.RIGHT, MScore.AUTODirectionH.LEFT, DirectionH.RIGHT, DirectionH.AUTO
  • OrnamentStyle
    MScore.DEFAULT, MScore.BAROQUEOrnamentStyle.DEFAULT, OrnamentStyle.BAROQUE
  • GlissandoStyle
    MScore.CHROMATIC, MScore.WHITE_KEYS, MScore.BLACK_KEYS, MScore.DIATONICGlissandoStyle.CHROMATIC etc.
  • TextStyleTypeTid
  • NoteHeadType
    HEAD_AUTO, HEAD_WHOLE, HEAD_HALF, HEAD_QUARTER, HEAD_BREVIS, HEAD_TYPES are now in NoteHeadType enumeration.
  • NoteHeadGroup
    Other HEAD_* values are in NoteHeadGroup enumeration.
  • NoteValueType
    Note.OFFSET_VAL, Note.USER_VALNoteValueType.OFFSET_VAL, NoteValueType.USER_VAL