1import QtQuick 2.0
2import MuseScore 3.0
3
4MuseScore {
5      version:  "3.0"
6      description: "This demo plugin creates a new score."
7      menuPath: "Plugins.createscore"
8      requiresScore: false
9
10      onRun: {
11            console.log("hello createscore");
12            var score = newScore("Test-Score", "piano", 5);
13            var numerator = 3;
14            var denominator = 4;
15
16            score.addText("title", "==Test-Score==");
17            score.addText("subtitle", "subtitle");
18            score.addText("composer", "Composer");
19            score.addText("lyricist", "Lyricist");
20
21            var cursor = score.newCursor();
22            cursor.track = 0;
23
24            cursor.rewind(0);
25            var ts = newElement(Element.TIMESIG);
26            ts.timesig = fraction(numerator, denominator);
27            cursor.add(ts);
28
29            cursor.rewind(0);
30            cursor.setDuration(1, 4);
31            cursor.addNote(60);
32
33            cursor.next();
34            cursor.setDuration(3, 8);
35            cursor.addNote(64);
36
37            cursor.next();
38            cursor.setDuration(1, 4);
39            cursor.addNote(68);
40
41            cursor.next();
42            cursor.addNote(72);
43
44            Qt.quit();
45            }
46      }
47