on xenial help sign in
use an AbstractButton instead of an Item and a MouseArea
commitdd6b06307d97073a80e501520c053135fbc07bc6 authorMichael Zanetti <michael.zanetti@canonical.com> dateFri 15 Nov 2013, 17:20 (13 years ago) parent65e27d3
1 file changed+21−20
Dash/Music/MusicPreview.qml+21−20
Dash/Music/MusicPreview.qml+21−20
@@ -118,32 +118,33 @@ GenericPreview {
118118 property int column3Width: units.gu(4)
119119 anchors.verticalCenter: parent.verticalCenter
120120
121− UbuntuShape {
122− id: playButtonShape
121+ AbstractButton {
123122 objectName: "playButton"
124123 width: trackRow.column1Width
125124 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− }
134125
135− MouseArea {
126+ UbuntuShape {
127+ id: playButtonShape
136128 anchors.fill: parent
137− onClicked: {
138− if (trackItem.isPlayingItem) {
139− if (audioPlayer.playbackState == Audio.PlayingState) {
140− audioPlayer.pause();
141− } else if (audioPlayer.playbackState == Audio.PausedState){
142− audioPlayer.play();
143− }
144− } else {
145− trackItem.play();
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+
139+ onClicked: {
140+ if (trackItem.isPlayingItem) {
141+ if (audioPlayer.playbackState == Audio.PlayingState) {
142+ audioPlayer.pause();
143+ } else if (audioPlayer.playbackState == Audio.PausedState){
144+ audioPlayer.play();
146145 }
146+ } else {
147+ trackItem.play();
147148 }
148149 }
149150 }