diff options
author | Yoann Lopes <yoann.lopes@nokia.com> | 2011-11-03 15:54:29 +0100 |
---|---|---|
committer | Yoann Lopes <yoann.lopes@nokia.com> | 2011-11-03 15:54:29 +0100 |
commit | 8ead54b40e873da5fde5fb95ab54ca599eadf6ec (patch) | |
tree | 2856769eb5a416d602fe05a0232a11a61aeacaf9 /qml | |
parent | 6d36f509fe3cb4e67e58260d536844fb3f60632e (diff) |
Push a PlaylistPage to the stack only when it's fully created.
Diffstat (limited to 'qml')
-rw-r--r-- | qml/PlaylistPage.qml | 9 | ||||
-rw-r--r-- | qml/TracklistPage.qml | 12 |
2 files changed, 14 insertions, 7 deletions
diff --git a/qml/PlaylistPage.qml b/qml/PlaylistPage.qml index 5a2bcbc..cb65fb3 100644 --- a/qml/PlaylistPage.qml +++ b/qml/PlaylistPage.qml @@ -99,8 +99,13 @@ Page { opacity: !spotifySession.offlineMode || modelData.availableOffline ? 1.0 : 0.3 onClicked: { - if (modelData.trackCount > 0) - pageStack.push(Qt.resolvedUrl("TracklistPage.qml"), { playlist: modelData }) + if (modelData.trackCount > 0) { + var component = Qt.createComponent("TracklistPage.qml"); + if (component.status == Component.Ready) { + var playlistPage = component.createObject(pageStack, { playlist: modelData }); + pageStack.push(playlistPage); + } + } } onPressAndHold: { menu.playlist = modelData; menu.open(); } diff --git a/qml/TracklistPage.qml b/qml/TracklistPage.qml index ea1a903..d5d277c 100644 --- a/qml/TracklistPage.qml +++ b/qml/TracklistPage.qml @@ -102,12 +102,19 @@ Page { } } + onPlaylistChanged: { + tracks.delegate = playlist.type == SpotifyPlaylist.Inbox ? inboxDelegate : trackDelegate + tracks.positionViewAtBeginning(); + } + ListView { id: tracks property bool showSearchField: false property bool _movementFromBeginning: false + Component.onCompleted: tracks.positionViewAtBeginning(); + Timer { id: searchFieldTimer onTriggered: tracks.showSearchField = false @@ -141,11 +148,6 @@ Page { _movementFromBeginning = false; } } - - Component.onCompleted: { - tracks.delegate = playlist.type == SpotifyPlaylist.Inbox ? inboxDelegate : trackDelegate - positionViewAtBeginning(); - } } Connections { |