Plugin documentation example for looping through parts
Using the plugin documentation, i've been trying to loop through the parts of a score.
Here's what I where all brought me:
var partsList = curScore.excerpts;
console.log(excerptsAccess.count(partsList));
// with excerptsAccess defined as follow:
QmlExcerptsListAccess {
id: excerptsAccess
}
But apparently I can't count the elements in that excerpts list. (Error being QmlExcerptsListAccess is not a type)
So if anyone knows how to make it work, he'd make a happy man.
Comments
Looks like the QmlExcerptsListAccess object doesn't have a default constructor, and thus cannot be used from qml.
Implementation: https://github.com/musescore/MuseScore/blob/773481cbe468d71271d3fb11dea…
In reply to Looks like the… by ecstrema
You don't need to construct that object yourself but should rather use an object obtained from
excerpts
property of Score object:In reply to You don't need to construct… by dmitrio95
Thanks it worked.
What is the
QmlExcerptsListAccess
for then?In reply to Thanks it worked. What is… by ecstrema
It's the type of object you get returned. But it is just a wrapping container type, which is why there is no exposure of the full class. Instantiating it yourself would at this point gain you nothing.
Is there any reason for you to want to create such an object yourself; and to what end?
In reply to It's the type of object you… by jeetee
I got the wrong idea that for some reason it was the right way of iterating through the breaks.
This shouldn't be in the doc though, if it's not used in plugins. (or maybe it should just be better documented?)
In reply to I got the wrong idea that… by ecstrema
It is used, it's the type of object you get when you access the excerpts property. It's just a type of object you can't create from within a script yourself, as it wouldn't have any meaning.