Style settings - musescore/MuseScore GitHub Wiki

Engraving style settings determine how the music is displayed (e.g., page height, bar width, 8va line style, etc.).

Using settings

If you're working in /src/engraving/libmscore, you need to import the style header file:

#include "style/style.h"

Then, as long as the class inherits from EngravingObject (which it probably does), you can access a specific settings value with:

score()->styleS(Sid idx); // for spatium values as a spatium
score()->styleP(Sid idx); // for spatium values as a qreal
score()->styleSt(Sid idx); // for QString values
score()->styleB(Sid idx); // for boolean values
score()->styleD(Sid idx); // for qreal values
score()->styleI(Sid idx); // for integer values

For instance, to get the staff line width as a qreal, you'd use:

score()->styleP(Sid::staffLineWidth)

You can discover all style settings in /src/engraving/style/styledef.h.

Adding new settings

Settings are declared in /src/engraving/style/styledef.h and defined in /src/engraving/style/styledef.cpp.

  1. Add your new setting to the Sid enum in /src/engraving/style/styledef.h
  2. Add the default value to /src/engraving/style/styledef.cpp

Exposing settings to users

When these settings are exposed to users, they appear in the Format > Style… menu.

[TODO]

⚠️ **GitHub.com Fallback** ⚠️