From b153f90a4c7f76a5ce5f4985bdbd687ba1602fdb Mon Sep 17 00:00:00 2001 From: Arno Date: Fri, 18 Jun 2010 15:52:01 +0200 Subject: Created frontend for SeriesTreeModel::deleteFromSeries Implemented frontend for SeriesTreeModel::deleteFromSeries. I hope QPersistentModelIndexes work as advertised. From the qt-sources it seems that a QPersistentModelIndex is automatically updated by QAbstractItemModel when calling begin(Remove|Insert)Rows. Testing worked out fine. While at it I found a bug in SmTreeModel. removeRows has to be called with (i - 1) instead of (i) to remove the correct nodes. --- seriestreemodel.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'seriestreemodel.cpp') diff --git a/seriestreemodel.cpp b/seriestreemodel.cpp index b8a4425..846f00c 100644 --- a/seriestreemodel.cpp +++ b/seriestreemodel.cpp @@ -196,6 +196,7 @@ bool SeriesTreeModel::deleteFromSeries(const QModelIndex &what){ foreach(QFileInfo fi, files){ QFile::remove(fi.absoluteFilePath()); } + removeRows(what.row(), 1, what.parent()); return true; } } -- cgit v1.2.3-70-g09d2