Manupulating staves

• Jul 4, 2017 - 10:00

I don't see any definition for Staff object. How can I add a new staff, remove a staff, or change staff properties?


In reply to by gideonrv

Not via the cmd way as you can't do anything in a opened dialog that way.

From the plugin reference manual in the plugin creator.
A Score object (such as curScore) has a read-only array parts of objects of the type Part. This corresponds with an 'instrument'. Further looking at the definition of the Part in the scripting engine reveals there are only a few properties you can change for it; being longName, mute, partName, shortName, show, volume which correspond with some of the properties available in the staff-properties dialog.

The Score object does allow you to add a new part to it using void appendPart(const QString&). The string you have to provide should be (an educated guess, not tested) the value of the id property from the Instrument tag from the instruments.xml file (…)

In reply to by jeetee

Jeetee, thank you very much. I understand now that Part is not as in Sibelius, but it stands for Instrument and Stuff.

I tried your solution, and your educated guess works. I only had to to some refreshing, like this:


Still, I am far away from my goal, which is creating auto accompaniment, like they did in Harmony Assistant. The worst part is the Harmony object, as I referred here .

In reply to by gideonrv

FWIW, I first learned C++ back in 1987, or as I sometimes say, about 10 minutes after Bjarne Stroustrup invented it :-). After a few years in the software world, I took an almost twenty year hiatus to do music full time before getting back into C++ programming specifically to help with MuseScore. So I do know a thing or two about old war horses going back into battle :-)

In reply to by Marc Sabatella

Talking about old horses, I am exactly 5 years older than Bjarne Stroustrup :-)

To start with, I am interested in exposing more properties of the Harmony object. I looked into harmony.h, and found that you made a fix 26 days ago, which means that you understand something about this object. then I found that there are three Q_PROPERTY macro calls corresponding to the three exposed properties. I found also two interesting internal variables: QString _textName and QList _degreeList, and I suspect that they keep the information I need.

So before I learn to use Qt Creator, GitHub, and all the other staff, would you like to expose those two properties?

Do you still have an unanswered question? Please log in first to post your question.