From 9cec02184a352b02045d974956a6353bd4769559 Mon Sep 17 00:00:00 2001 From: SeeLook <seelook@gmail.com> Date: Sat, 8 Feb 2025 10:32:29 +0100 Subject: [PATCH] Use proper JS syntax for Connections --- src/qml/MainScore.qml | 2 +- src/qml/MainWindow.qml | 35 +++++++++++++++-------------------- 2 files changed, 16 insertions(+), 21 deletions(-) diff --git a/src/qml/MainScore.qml b/src/qml/MainScore.qml index 243ff879..ad402829 100644 --- a/src/qml/MainScore.qml +++ b/src/qml/MainScore.qml @@ -134,7 +134,7 @@ Score { MouseArea { anchors.fill: parent //z: -1 - onWheel: { + onWheel: wheel => { if (wheel.modifiers & Qt.ControlModifier) { if (wheel.angleDelta.y > 0) zoom(true); diff --git a/src/qml/MainWindow.qml b/src/qml/MainWindow.qml index 5d172b02..c5d9d452 100644 --- a/src/qml/MainWindow.qml +++ b/src/qml/MainWindow.qml @@ -12,6 +12,7 @@ ApplicationWindow { property bool topToBott: height > width property real shortEdge: Math.min(height, width * (GLOB.instrument.isSax ? 0.85 : 1)) property alias mainMenu: mainMenu + // private property var noteName: null property var examResults: null @@ -80,6 +81,7 @@ ApplicationWindow { x: GLOB.geometry.x y: GLOB.geometry.y header: mainMenu.toolBar + Component.onCompleted: { NOO.mainScore = score; checkSingleMode(); @@ -95,7 +97,8 @@ ApplicationWindow { createStatus(); } } - onClosing: { + + onClosing: close => { if (NOO.isAndroid() && dialogLoader && dialogLoader.visible) { close.accepted = false; dialogLoader.close(); @@ -103,7 +106,6 @@ ApplicationWindow { if (executor) { if (!executor.closeNootka()) close.accepted = false; - } if (close.accepted) GLOB.geometry = Qt.rect(x, y, width, height); @@ -114,25 +116,23 @@ ApplicationWindow { id: activPal property color dimText: Qt.tint(activPal.base, NOO.alpha(activPal.text, 150)) - colorGroup: SystemPalette.Active } SystemPalette { id: disdPal - colorGroup: SystemPalette.Disabled } Connections { target: NOO - onScoreActTriggered: mainMenu.open() - onMelodyActTriggered: mainMenu.melodyOpen() - onSettingsActTriggered: showDialog(Nootka.Settings) - onLevelActTriggered: showDialog(Nootka.LevelCreator) - onChartsActTriggered: showDialog(Nootka.Charts) - onExamActTriggered: showDialog(Nootka.ExamStart) - onAboutActTriggered: showDialog(Nootka.About) + function onScoreActTriggered() : void { mainMenu.open() } + function onMelodyActTriggered() : void { mainMenu.melodyOpen() } + function onSettingsActTriggered() : void { showDialog(Nootka.Settings) } + function onLevelActTriggered() : void { showDialog(Nootka.LevelCreator) } + function onChartsActTriggered() : void { showDialog(Nootka.Charts) } + function onExamActTriggered() : void { showDialog(Nootka.ExamStart) } + function onAboutActTriggered() : void { showDialog(Nootka.About) } } MainMenu { @@ -168,34 +168,29 @@ ApplicationWindow { Connections { target: GLOB - onSingleNoteModeChanged: checkSingleMode() - onIsExamChanged: { + function onSingleNoteModeChanged() : void { checkSingleMode() } + function onIsExamChanged() : void { if (GLOB.isExam) { if (!executor) executor = Qt.createComponent("qrc:/exam/ExamExecutor.qml").createObject(); - if (!examResults) examResults = Qt.createComponent("qrc:/exam/ExamResults.qml").createObject(nootkaWindow.contentItem); - } else { if (examResults) examResults.destroy(); - } } - onWantOpenFile: { + function onWantOpenFile() : void { showDialog(Nootka.NoDialog); dialogLoader.openFile(fileName); } - onShowNotesDiffChanged: { + function onShowNotesDiffChanged() : void { if (GLOB.showNotesDiff) { if (!notesBarItem) notesBarItem = Qt.createComponent("qrc:/sound/NotesDiffBar.qml").createObject(nootkaWindow.contentItem); - } else { if (notesBarItem) notesBarItem.destroy(); - } } } -- GitLab