diff --git a/src/activities/piano_composition/MultipleStaff.qml b/src/activities/piano_composition/MultipleStaff.qml --- a/src/activities/piano_composition/MultipleStaff.qml +++ b/src/activities/piano_composition/MultipleStaff.qml @@ -41,6 +41,8 @@ property alias flickableStaves: flickableStaves + signal noteClicked(string noteName, string noteLength) + Flickable { id: flickableStaves flickableDirection: Flickable.VerticalFlick @@ -191,7 +193,7 @@ staves.itemAt(currentPlayedStaff).initMetronome(); } musicTimer.interval = staves.itemAt(currentPlayedStaff).notes.get(currentNote).mDuration - staves.itemAt(currentPlayedStaff).notesRepeater.itemAt(currentNote).play() + staves.itemAt(currentPlayedStaff).notesRepeater.itemAt(currentNote).highlightNote() currentNote ++ if(currentNote > nbMaxNotesPerStaff) { currentNote = 0 diff --git a/src/activities/piano_composition/Note.qml b/src/activities/piano_composition/Note.qml --- a/src/activities/piano_composition/Note.qml +++ b/src/activities/piano_composition/Note.qml @@ -88,7 +88,7 @@ opacity: 0.6 border.color: "white" radius: width / 6 - visible: false + visible: noteMouseArea.containsMouse || highlightTimer.running } Image { diff --git a/src/activities/piano_composition/Piano_composition.qml b/src/activities/piano_composition/Piano_composition.qml --- a/src/activities/piano_composition/Piano_composition.qml +++ b/src/activities/piano_composition/Piano_composition.qml @@ -170,6 +170,7 @@ anchors.top: instructionBox.bottom anchors.topMargin: parent.height * 0.1 anchors.rightMargin: parent.width * 0.043 + onNoteClicked: playNoteAudio(noteName, noteLength) } GCButtonScroll { diff --git a/src/activities/piano_composition/Staff.qml b/src/activities/piano_composition/Staff.qml --- a/src/activities/piano_composition/Staff.qml +++ b/src/activities/piano_composition/Staff.qml @@ -173,17 +173,14 @@ } MouseArea { + id: noteMouseArea anchors.fill: parent - onClicked: { - print(items.staffLength) - print(items.background.width,items.background.height) - } + hoverEnabled: true + onClicked: multipleStaff.noteClicked(noteName, noteType) } - function play() { -// if(highlightWhenPlayed) { - highlightTimer.start(); -// } + function highlightNote() { + highlightTimer.start() } y: {