From 4815bb9f11cd71f4d8b6c1431499edefbdc5880a Mon Sep 17 00:00:00 2001 From: Christophe Dumez Date: Tue, 28 Sep 2010 16:53:58 +0000 Subject: [PATCH] Fix wrong mapping to source model --- src/transferlistwidget.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/transferlistwidget.cpp b/src/transferlistwidget.cpp index 5a994b027..d112ccab4 100644 --- a/src/transferlistwidget.cpp +++ b/src/transferlistwidget.cpp @@ -584,10 +584,17 @@ inline QString TransferListWidget::getHashFromRow(int row) const { } inline QModelIndex TransferListWidget::mapToSource(const QModelIndex &index) const { - return labelFilterModel->mapToSource(statusFilterModel->mapToSource(nameFilterModel->mapToSource(index))); + Q_ASSERT(index.isValid()); + if(index.model() == nameFilterModel) + return labelFilterModel->mapToSource(statusFilterModel->mapToSource(nameFilterModel->mapToSource(index))); + if(index.model() == statusFilterModel) + return labelFilterModel->mapToSource(statusFilterModel->mapToSource(index)); + return labelFilterModel->mapToSource(index); } inline QModelIndex TransferListWidget::mapFromSource(const QModelIndex &index) const { + Q_ASSERT(index.isValid()); + Q_ASSERT(index.model() == labelFilterModel); return nameFilterModel->mapFromSource(statusFilterModel->mapFromSource(labelFilterModel->mapFromSource(index))); } @@ -1426,6 +1433,7 @@ void TransferListWidget::loadLastSortedColumn() { } void TransferListWidget::currentChanged(const QModelIndex& current, const QModelIndex&) { + qDebug("CURRENT CHANGED"); QTorrentHandle h; if(current.isValid()) { const int row = mapToSource(current).row();