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. --- smtreemodel.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'smtreemodel.cpp') diff --git a/smtreemodel.cpp b/smtreemodel.cpp index 227c1cb..2a230cc 100644 --- a/smtreemodel.cpp +++ b/smtreemodel.cpp @@ -153,7 +153,7 @@ bool SmTreeModel::removeRows(int row, int count, const QModelIndex &parent){ beginRemoveRows(parent, row, row + count - 1); for(int i = row + count; i > row; --i){ - retval = parentItem->removeChild(i); + retval = parentItem->removeChild(i - 1); } endRemoveRows(); -- cgit v1.2.3-70-g09d2