From d924a6414962435a0695441216474c7d95044233 Mon Sep 17 00:00:00 2001 From: Arno Date: Fri, 27 May 2011 16:25:59 +0200 Subject: Fix removal of items from FilesTreeWidget When setting the dvd no. on several items in FilesTreeWidget, QModelIndex was used in a foreach() loop. Since the loop alters the model, the subsequent operations failed or operated on the wrong Indexes. Fixed by using a QPersistenModelIndex instead. --- filestreewidget.cpp | 2 +- filestreewidget.h | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/filestreewidget.cpp b/filestreewidget.cpp index 983ddeb..2aa32d2 100644 --- a/filestreewidget.cpp +++ b/filestreewidget.cpp @@ -200,7 +200,7 @@ void FilesTreeWidget::edit(int column){ if(!cols.values().contains(column)){ return; } - QModelIndexList sIdxes; + PersistenModelIndexList sIdxes; foreach(QModelIndex idx, currentSel){ QModelIndex pIdx = filesTree()->model()->index(idx.row(), column, idx.parent()); if(pIdx.isValid()){ diff --git a/filestreewidget.h b/filestreewidget.h index 86210c3..73e53b3 100644 --- a/filestreewidget.h +++ b/filestreewidget.h @@ -13,6 +13,8 @@ #include #include +typedef QList PersistenModelIndexList; + class FilesTreeView; class FilesTreeModel; class FilesTreeSortModel; -- cgit v1.2.3-70-g09d2