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>
This commit is contained in:
committed by
Yoann Lopes
parent
475a14ccc3
commit
6684b4b23b
@@ -214,8 +214,10 @@ bool QMediaPlaylist::setMediaObject(QMediaObject *mediaObject)
|
|||||||
connect(d->control, SIGNAL(currentMediaChanged(QMediaContent)),
|
connect(d->control, SIGNAL(currentMediaChanged(QMediaContent)),
|
||||||
this, SIGNAL(currentMediaChanged(QMediaContent)));
|
this, SIGNAL(currentMediaChanged(QMediaContent)));
|
||||||
|
|
||||||
if (oldSize)
|
if (oldSize) {
|
||||||
|
emit mediaAboutToBeRemoved(0, oldSize-1);
|
||||||
emit mediaRemoved(0, oldSize-1);
|
emit mediaRemoved(0, oldSize-1);
|
||||||
|
}
|
||||||
|
|
||||||
if (playlist->mediaCount()) {
|
if (playlist->mediaCount()) {
|
||||||
emit mediaAboutToBeInserted(0,playlist->mediaCount()-1);
|
emit mediaAboutToBeInserted(0,playlist->mediaCount()-1);
|
||||||
|
|||||||
Reference in New Issue
Block a user