Fix wrong mapping to source model

This commit is contained in:
Christophe Dumez
2010-09-28 16:56:49 +00:00
parent 8c85ffca5f
commit 7dde763fc6
2 changed files with 10 additions and 1 deletions

View File

@@ -1,6 +1,7 @@
* Mon Sep 27 2010 - Christophe Dumez <chris@qbittorrent.org> - v2.4.3 * Mon Sep 27 2010 - Christophe Dumez <chris@qbittorrent.org> - v2.4.3
- BUGFIX: Fix encoding issue in command line parameters processing - BUGFIX: Fix encoding issue in command line parameters processing
- BUGFIX: Fix possible crash when changing the save path in addition dialog - BUGFIX: Fix possible crash when changing the save path in addition dialog
- BUGFIX: Fix wrong mapping to source model
* Sun Sep 26 2010 - Christophe Dumez <chris@qbittorrent.org> - v2.4.2 * Sun Sep 26 2010 - Christophe Dumez <chris@qbittorrent.org> - v2.4.2
- BUGFIX: Fix display of torrent content in addition dialog - BUGFIX: Fix display of torrent content in addition dialog

View File

@@ -584,10 +584,17 @@ inline QString TransferListWidget::getHashFromRow(int row) const {
} }
inline QModelIndex TransferListWidget::mapToSource(const QModelIndex &index) const { inline QModelIndex TransferListWidget::mapToSource(const QModelIndex &index) const {
Q_ASSERT(index.isValid());
if(index.model() == nameFilterModel)
return labelFilterModel->mapToSource(statusFilterModel->mapToSource(nameFilterModel->mapToSource(index))); 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 { 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))); return nameFilterModel->mapFromSource(statusFilterModel->mapFromSource(labelFilterModel->mapFromSource(index)));
} }
@@ -1426,6 +1433,7 @@ void TransferListWidget::loadLastSortedColumn() {
} }
void TransferListWidget::currentChanged(const QModelIndex& current, const QModelIndex&) { void TransferListWidget::currentChanged(const QModelIndex& current, const QModelIndex&) {
qDebug("CURRENT CHANGED");
QTorrentHandle h; QTorrentHandle h;
if(current.isValid()) { if(current.isValid()) {
const int row = mapToSource(current).row(); const int row = mapToSource(current).row();