[PATCH 1/3] Port from QAbstractItemModel::reset() to QAbstractItemModel::(begin|end)ResetModel().

Jon Severinsson jon at severinsson.net
Sat Oct 6 18:12:06 UTC 2012


This is the recommended API in Qt >= 4.6, and the only API in Qt5.
---
 phonon/objectdescriptionmodel.cpp |    3 ++-
 phonon/objectdescriptionmodel_p.h |    3 ++-
 2 filer ändrade, 4 tillägg(+), 2 borttagningar(-)

diff --git a/phonon/objectdescriptionmodel.cpp b/phonon/objectdescriptionmodel.cpp
index 97a8b5d..7be70ac 100644
--- a/phonon/objectdescriptionmodel.cpp
+++ b/phonon/objectdescriptionmodel.cpp
@@ -280,8 +280,9 @@ ObjectDescriptionModelData::~ObjectDescriptionModelData()
 
 void ObjectDescriptionModelData::setModelData(const QList<QExplicitlySharedDataPointer<ObjectDescriptionData> > &newData)
 {
+    d->model->beginResetModel();
     d->data = newData;
-    d->model->reset();
+    d->model->endResetModel();
 }
 
 QList<QExplicitlySharedDataPointer<ObjectDescriptionData> > ObjectDescriptionModelData::modelData() const
diff --git a/phonon/objectdescriptionmodel_p.h b/phonon/objectdescriptionmodel_p.h
index 2200c8d..d7cc38b 100644
--- a/phonon/objectdescriptionmodel_p.h
+++ b/phonon/objectdescriptionmodel_p.h
@@ -40,7 +40,8 @@ class ListModelHelper : public QAbstractListModel
         using QAbstractListModel::layoutAboutToBeChanged;
         using QAbstractListModel::changePersistentIndexList;
         using QAbstractListModel::layoutChanged;
-        using QAbstractListModel::reset;
+        using QAbstractListModel::beginResetModel;
+        using QAbstractListModel::endResetModel;
         using QAbstractListModel::beginInsertRows;
         using QAbstractListModel::endInsertRows;
         using QAbstractListModel::beginRemoveRows;
-- 
1.7.10.4



More information about the Kde-frameworks-devel mailing list