scripting update
This commit is contained in:
parent
3f1312b25c
commit
3ab304d157
7 changed files with 28 additions and 28 deletions
|
@ -420,18 +420,18 @@ QQmlEngine* MScore::qml()
|
|||
_qml->setImportPathList(importPaths);
|
||||
#endif
|
||||
const char* enumErr = "You can't create an enumeration";
|
||||
qmlRegisterType<MsProcess> ("MuseScore", 1, 0, "QProcess");
|
||||
qmlRegisterType<FileIO, 1> ("FileIO", 1, 0, "FileIO");
|
||||
qmlRegisterType<MsProcess> ("MuseScore", 3, 0, "QProcess");
|
||||
qmlRegisterType<FileIO, 1> ("FileIO", 3, 0, "FileIO");
|
||||
//-----------mscore bindings
|
||||
qmlRegisterUncreatableMetaObject(Ms::staticMetaObject, "MuseScore", 1, 0, "Ms", enumErr);
|
||||
// qmlRegisterUncreatableType<Direction>("MuseScore", 1, 0, "Direction", tr(enumErr));
|
||||
qmlRegisterUncreatableMetaObject(Ms::staticMetaObject, "MuseScore", 3, 0, "Ms", enumErr);
|
||||
// qmlRegisterUncreatableType<Direction>("MuseScore", 3, 0, "Direction", tr(enumErr));
|
||||
|
||||
qmlRegisterType<MScore> ("MuseScore", 1, 0, "MScore");
|
||||
qmlRegisterType<MsScoreView>("MuseScore", 1, 0, "ScoreView");
|
||||
qmlRegisterType<MScore> ("MuseScore", 3, 0, "MScore");
|
||||
qmlRegisterType<MsScoreView>("MuseScore", 3, 0, "ScoreView");
|
||||
|
||||
qmlRegisterType<Score> ("MuseScore", 1, 0, "Score");
|
||||
qmlRegisterType<Cursor> ("MuseScore", 1, 0, "Cursor");
|
||||
qmlRegisterType<ElementW> ("MuseScore", 1, 0, "Element");
|
||||
qmlRegisterType<Score> ("MuseScore", 3, 0, "Score");
|
||||
qmlRegisterType<Cursor> ("MuseScore", 3, 0, "Cursor");
|
||||
qmlRegisterType<ElementW> ("MuseScore", 3, 0, "Element");
|
||||
qRegisterMetaType<ElementW*>("ElementWrapper*");
|
||||
#if 0
|
||||
qmlRegisterType<Segment> ("MuseScore", 1, 0, "Segment");
|
||||
|
@ -472,7 +472,7 @@ QQmlEngine* MScore::qml()
|
|||
qmlRegisterType<SlurTie>();
|
||||
qmlRegisterType<Spanner>();
|
||||
#endif
|
||||
qmlRegisterType<FractionWrapper> ("MuseScore", 1, 1, "Fraction");
|
||||
qmlRegisterType<FractionWrapper> ("MuseScore", 3, 1, "Fraction");
|
||||
qRegisterMetaType<FractionWrapper*>("FractionWrapper*");
|
||||
}
|
||||
return _qml;
|
||||
|
|
|
@ -5935,7 +5935,8 @@ int main(int argc, char* av[])
|
|||
#endif
|
||||
|
||||
#ifdef SCRIPT_INTERFACE
|
||||
qmlRegisterType<QmlPlugin> ("MuseScore", 2, 0, "MuseScore");
|
||||
if (-1 == qmlRegisterType<QmlPlugin> ("MuseScore", 3, 0, "MuseScore"))
|
||||
qDebug("qmlRegisterType failed: MuseScore");
|
||||
#endif
|
||||
if (MScore::debugMode) {
|
||||
qDebug("DPI %f", DPI);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import QtQuick 2.0
|
||||
import MuseScore 1.0
|
||||
import MuseScore 3.0
|
||||
|
||||
MuseScore {
|
||||
menuPath: "Plugins.p1"
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import QtQuick 2.0
|
||||
import MuseScore 1.0
|
||||
import MuseScore 3.0
|
||||
|
||||
MuseScore {
|
||||
menuPath: "Plugins.test2"
|
||||
version: "2.0"
|
||||
menuPath: "Plugins.test3"
|
||||
version: "3.0"
|
||||
description: "Test Plugin"
|
||||
|
||||
width: 150
|
||||
|
|
|
@ -91,7 +91,7 @@ void TestScripting::initTestCase()
|
|||
{
|
||||
initMTest();
|
||||
qmlRegisterType<MScore> ("MuseScore", 1, 0, "MScore");
|
||||
qmlRegisterType<QmlPlugin> ("MuseScore", 1, 0, "MuseScore");
|
||||
qmlRegisterType<QmlPlugin> ("MuseScore", 3, 0, "MuseScore");
|
||||
MsQmlEngine = Ms::MScore::qml();
|
||||
}
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
//=============================================================================
|
||||
|
||||
import QtQuick 2.0
|
||||
import MuseScore 1.0
|
||||
import MuseScore 3.0
|
||||
|
||||
MuseScore {
|
||||
version: "1.0"
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
// MuseScore
|
||||
// Music Composition & Notation
|
||||
//
|
||||
// Copyright (C) 2012 Werner Schweer
|
||||
// Copyright (C) 2012-2017 Werner Schweer
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License version 2
|
||||
|
@ -11,10 +11,10 @@
|
|||
//=============================================================================
|
||||
|
||||
import QtQuick 2.0
|
||||
import MuseScore 1.0
|
||||
import MuseScore 3.0
|
||||
|
||||
MuseScore {
|
||||
version: "1.0"
|
||||
version: "3.0"
|
||||
description: "This test plugin walks through all elements in a score"
|
||||
menuPath: "Plugins.Walk"
|
||||
|
||||
|
@ -25,18 +25,17 @@ MuseScore {
|
|||
Qt.quit();
|
||||
|
||||
var cursor = curScore.newCursor();
|
||||
cursor.rewind(0);
|
||||
cursor.voice = 0;
|
||||
cursor.staffIdx = 0;
|
||||
cursor.filter = -1;
|
||||
cursor.rewind(0);
|
||||
|
||||
while (cursor.segment()) {
|
||||
var element = cursor.element();
|
||||
if (element) {
|
||||
var type = element.type;
|
||||
console.log("type: " + element.type + " tick: " + element.tick() + " color " + element.get("color"));
|
||||
if (type == "Rest") {
|
||||
var d = element.get("duration");
|
||||
console.log(d);
|
||||
var e = cursor.element();
|
||||
if (e) {
|
||||
console.log("type: " + e.name + " (" + e.type + ") at tick: " + e.tick + " color " + e.get("color"));
|
||||
if (e.type == Ms.REST) {
|
||||
var d = e.get("duration");
|
||||
console.log(" duration " + d.numerator + "/" + d.denominator);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue