From 4abe6ada31e054b4434110b015b557c00ec17968 Mon Sep 17 00:00:00 2001 From: Joachim Schmitz Date: Sun, 28 May 2023 13:26:17 +0200 Subject: [PATCH 1/3] Port to MuseScore 4 while maintaining MuseScore 3 compatibility --- comments.qml | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/comments.qml b/comments.qml index d04a27d..3bcae60 100644 --- a/comments.qml +++ b/comments.qml @@ -12,13 +12,25 @@ MuseScore { //pluginType : "Dialog" //requiresScore: true // needs MuseScore > 2.0.3 + Component.onCompleted : { + if (mscoreMajorVersion >= 4) { + title = qsTr("Comments") ; + // thumbnailName = ".png"; + // categoryCode = "some_category"; + } + } onRun : { + + curScore.startCmd() + if (!curScore) { - Qt.quit(); + quit(); } else { window.visible = true } + + curScore.endCmd() } Window { @@ -115,7 +127,7 @@ MuseScore { curScore.setMetaTag("comments", abcText.text) settings.metrics = JSON.stringify(metrics); } - Qt.quit() + quit() } //Added onActiveChanged so we can test if the score has been changed. onActiveChanged : { From 56d40ea6fa7168f2001fb608ddd4cf71f6acdf86 Mon Sep 17 00:00:00 2001 From: Joachim Schmitz Date: Sun, 28 May 2023 13:27:11 +0200 Subject: [PATCH 2/3] Fix colors for dark theme to a color that works in light and dark theme --- comments.qml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/comments.qml b/comments.qml index 3bcae60..8a4b9d3 100644 --- a/comments.qml +++ b/comments.qml @@ -44,7 +44,7 @@ MuseScore { property var score : curScore //SL Added title so it is obvious which score the text will be added to title : {"MuseScore : " + curScore.name} - color : "silver" + color : "gray" Settings { id : settings @@ -76,7 +76,7 @@ MuseScore { anchors.topMargin : textLabel.height + 5 anchors.bottomMargin : 5 - color : "lightgray" + color : "gray" radius : 2 TextArea { From 92884f846f7ffa6c2f4b61351da9637cc921a9d6 Mon Sep 17 00:00:00 2001 From: Joachim Schmitz Date: Sun, 28 May 2023 13:27:47 +0200 Subject: [PATCH 3/3] Fix a warning from QtCreator --- comments.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/comments.qml b/comments.qml index 8a4b9d3..69c6f22 100644 --- a/comments.qml +++ b/comments.qml @@ -91,7 +91,7 @@ MuseScore { textFormat : TextEdit.PlainText //SL Changed from onPressed as in some circumstances the last key pressed was lost. Keys.onReleased : { - if (event.key == Qt.Key_Escape) { + if (event.key === Qt.Key_Escape) { window.close(); } else { curScore.setMetaTag("comments", abcText.text)