diff options
author | Loïc Molinari <loic.molinari@canonical.com> | 2015-08-10 13:38:47 +0200 |
---|---|---|
committer | Yoann Lopes <yoann.lopes@theqtcompany.com> | 2015-08-10 12:13:21 +0000 |
commit | 6684b4b23b2fd8a1fc4ae4f9b2f8bd90cd1e5846 (patch) | |
tree | 84f4c6b8a1f948053f78f5124a5e00009c57dadc | |
parent | 475a14ccc39aad0f73b039990412b00f52e0c81e (diff) | |
download | qtmultimedia-6684b4b23b2fd8a1fc4ae4f9b2f8bd90cd1e5846.tar.gz qtmultimedia-6684b4b23b2fd8a1fc4ae4f9b2f8bd90cd1e5846.tar.bz2 qtmultimedia-6684b4b23b2fd8a1fc4ae4f9b2f8bd90cd1e5846.zip |
Emit mediaAboutToBeRemoved() before mediaRemoved() in QMediaPlaylist.
When a new playlist's mediaObject is set, the content is cleared and the
mediaRemoved() signal is emitted without a former
mediaAboutToBeRemoved(). This is an issue for QAbstractItemModel
implementations, like the coming QDeclarativePlaylist, which call
beginInsertRow() and endInsertRows() in the respective signal handlers.
Change-Id: I7ec512ff2736e92858df94d9479741e05162e1f0
Reviewed-by: Yoann Lopes <yoann.lopes@theqtcompany.com>
-rw-r--r-- | src/multimedia/playback/qmediaplaylist.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/multimedia/playback/qmediaplaylist.cpp b/src/multimedia/playback/qmediaplaylist.cpp index 9b5d9a68..06813592 100644 --- a/src/multimedia/playback/qmediaplaylist.cpp +++ b/src/multimedia/playback/qmediaplaylist.cpp @@ -214,8 +214,10 @@ bool QMediaPlaylist::setMediaObject(QMediaObject *mediaObject) connect(d->control, SIGNAL(currentMediaChanged(QMediaContent)), this, SIGNAL(currentMediaChanged(QMediaContent))); - if (oldSize) + if (oldSize) { + emit mediaAboutToBeRemoved(0, oldSize-1); emit mediaRemoved(0, oldSize-1); + } if (playlist->mediaCount()) { emit mediaAboutToBeInserted(0,playlist->mediaCount()-1); |