From 69791ade746638180a959c190fa5db6519c83a38 Mon Sep 17 00:00:00 2001 From: Arno Date: Sun, 7 Apr 2013 08:48:49 +0200 Subject: Bugfix when setting DVD number Don't call refresh on model after setting the dvd no for an index. Then the selection is lost and the other selected indexes won't be updated. Call refresh from the view after updating all indexes instead. --- filestreemodel.cpp | 2 +- filestreewidget.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/filestreemodel.cpp b/filestreemodel.cpp index b841e8a..f7763e4 100644 --- a/filestreemodel.cpp +++ b/filestreemodel.cpp @@ -257,7 +257,7 @@ bool FilesTreeModel::setData(const QModelIndex &index, const QVariant &value, in mUpdateDvdQuery->bindValue(":id", index.data(FilesIdRole)); mUpdateDvdQuery->bindValue(":dvd", value); if(mUpdateDvdQuery->exec()){ - refresh(); + item->setData(DvdNo, value); return true; }else{ return false; diff --git a/filestreewidget.cpp b/filestreewidget.cpp index eec2fc3..0bf50da 100644 --- a/filestreewidget.cpp +++ b/filestreewidget.cpp @@ -239,9 +239,9 @@ void FilesTreeWidget::edit(int column){ } if(dialogOk){ foreach(QModelIndex curIdx, sIdxes){ - QModelIndex changeIdx = mModel->index(curIdx.row(), column, curIdx.parent()); - mModel->setData(changeIdx, value, Qt::EditRole); + mModel->setData(curIdx, value, Qt::EditRole); } + mModel->refresh(); mView->expandAll(); } } -- cgit v1.2.3-70-g09d2