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.BELOW → Placement.ABOVE, Placement.BELOW
- Direction — vertical direction
- MScore.UP, MScore.DOWN, MScore.AUTO → Direction.UP, Direction.DOWN, Direction.AUTO
- DirectionH — horizontal direction
- MScore.LEFT, MScore.RIGHT, MScore.AUTO → DirectionH.LEFT, DirectionH.RIGHT, DirectionH.AUTO
- OrnamentStyle
- MScore.DEFAULT, MScore.BAROQUE → OrnamentStyle.DEFAULT, OrnamentStyle.BAROQUE
- GlissandoStyle
- MScore.CHROMATIC, MScore.WHITE_KEYS, MScore.BLACK_KEYS, MScore.DIATONIC → GlissandoStyle.CHROMATIC etc.
- TextStyleType → Tid
- 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_VAL → NoteValueType.OFFSET_VAL, NoteValueType.USER_VAL