on xenial help sign in
use an AbstractButton instead of an Item and a MouseArea
dd6b063Michael Zanetti
Dash/Music/MusicPreview.qml+21−20
@@ -118,32 +118,33 @@ GenericPreview {
118 property int column3Width: units.gu(4)
118 property int column3Width: units.gu(4)
119 anchors.verticalCenter: parent.verticalCenter
119 anchors.verticalCenter: parent.verticalCenter
120
120
121− UbuntuShape {
121+ AbstractButton {
122− id: playButtonShape
123 objectName: "playButton"
122 objectName: "playButton"
124 width: trackRow.column1Width
123 width: trackRow.column1Width
125 height: width
124 height: width
126− Icon {
127− width: units.gu(2)
128− height: width
129− anchors.centerIn: playButtonShape
130− name: audioPlayer.playbackState == Audio.PlayingState && trackItem.isPlayingItem ? "media-playback-pause" : "media-playback-start"
131− color: "white"
132− opacity: .9
133− }
134
125
135− MouseArea {
126+ UbuntuShape {
127+ id: playButtonShape
136 anchors.fill: parent
128 anchors.fill: parent
129+ Icon {
130+ width: units.gu(2)
131+ height: width
132+ anchors.centerIn: playButtonShape
133+ name: audioPlayer.playbackState == Audio.PlayingState && trackItem.isPlayingItem ? "media-playback-pause" : "media-playback-start"
134+ color: "white"
135+ opacity: .9
136+ }
137+ }
138+
137− onClicked: {
139+ onClicked: {
138− if (trackItem.isPlayingItem) {
140+ if (trackItem.isPlayingItem) {
139− if (audioPlayer.playbackState == Audio.PlayingState) {
141+ if (audioPlayer.playbackState == Audio.PlayingState) {
140− audioPlayer.pause();
142+ audioPlayer.pause();
141− } else if (audioPlayer.playbackState == Audio.PausedState){
143+ } else if (audioPlayer.playbackState == Audio.PausedState){
142− audioPlayer.play();
144+ audioPlayer.play();
143− }
144− } else {
145− trackItem.play();
146 }
145 }
146+ } else {
147+ trackItem.play();
147 }
148 }
148 }
149 }
149 }
150 }