expose Excerpt to scripting
This commit is contained in:
parent
888d7db411
commit
78aa809b9f
3 changed files with 14 additions and 3 deletions
|
@ -22,17 +22,23 @@ class Staff;
|
|||
class XmlReader;
|
||||
|
||||
//---------------------------------------------------------
|
||||
// Excerpt
|
||||
// @@ Excerpt
|
||||
// @P partScore Ms::Score the score object for this part
|
||||
// @P title QString the title of this part
|
||||
//---------------------------------------------------------
|
||||
|
||||
class Excerpt {
|
||||
class Excerpt : public QObject {
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(Ms::Score* partScore READ partScore)
|
||||
Q_PROPERTY(QString title READ title)
|
||||
|
||||
Score* _oscore; // main score
|
||||
Score* _partScore { 0 };
|
||||
QString _title;
|
||||
QList<Part*> _parts;
|
||||
|
||||
public:
|
||||
Excerpt(Score* s) { _oscore = s; }
|
||||
Excerpt(Score* s = 0) { _oscore = s; }
|
||||
|
||||
QList<Part*>& parts() { return _parts; }
|
||||
void setParts(const QList<Part*>& p) { _parts = p; }
|
||||
|
|
|
@ -54,6 +54,7 @@
|
|||
#include "stem.h"
|
||||
#include "stemslash.h"
|
||||
#include "fraction.h"
|
||||
#include "excerpt.h"
|
||||
|
||||
namespace Ms {
|
||||
|
||||
|
@ -336,6 +337,7 @@ QQmlEngine* MScore::qml()
|
|||
qmlRegisterType<Stem> ("MuseScore", 1, 0, "Stem");
|
||||
qmlRegisterType<StemSlash> ("MuseScore", 1, 0, "StemSlash");
|
||||
qmlRegisterType<Beam> ("MuseScore", 1, 0, "Beam");
|
||||
qmlRegisterType<Excerpt> ("MuseScore", 1, 0, "Excerpt");
|
||||
qmlRegisterType<FractionWrapper> ("MuseScore", 1, 1, "Fraction");
|
||||
qRegisterMetaType<FractionWrapper*>("FractionWrapper*");
|
||||
|
||||
|
|
|
@ -247,6 +247,7 @@ enum class PasteStatus : char {
|
|||
// @P hasHarmonies bool score has chord symbols (read only)
|
||||
// @P keysig int key signature at the start of the score (read only)
|
||||
// @P duration int duration of score in seconds (read only)
|
||||
// @P excerpts array[Ms::Excerpt] the list of the excerpts (linked parts)
|
||||
//---------------------------------------------------------
|
||||
|
||||
class Score : public QObject {
|
||||
|
@ -270,6 +271,7 @@ class Score : public QObject {
|
|||
Q_PROPERTY(bool hasHarmonies READ hasHarmonies)
|
||||
Q_PROPERTY(int keysig READ keysig)
|
||||
Q_PROPERTY(int duration READ duration)
|
||||
Q_PROPERTY(QQmlListProperty<Ms::Excerpt> excerpts READ qmlExcerpts)
|
||||
Q_PROPERTY(Ms::PageFormat* pageFormat READ pageFormat WRITE undoChangePageFormat)
|
||||
|
||||
public:
|
||||
|
@ -473,6 +475,7 @@ class Score : public QObject {
|
|||
void selectRange(Element* e, int staffIdx);
|
||||
|
||||
QQmlListProperty<Ms::Part> qmlParts() { return QQmlListProperty<Ms::Part>(this, _parts); }
|
||||
QQmlListProperty<Ms::Excerpt> qmlExcerpts() { return QQmlListProperty<Ms::Excerpt>(this, _excerpts); }
|
||||
|
||||
protected:
|
||||
void createPlayEvents(Chord*);
|
||||
|
|
Loading…
Reference in a new issue