diff --git a/src/previewselect.cpp b/src/previewselect.cpp index ae4dc7bab..85708ee5a 100644 --- a/src/previewselect.cpp +++ b/src/previewselect.cpp @@ -76,9 +76,6 @@ PreviewSelect::PreviewSelect(QWidget* parent, QTorrentHandle h): QDialog(parent) } } - previewList->selectionModel()->select(previewListModel->index(0, NAME), QItemSelectionModel::Select); - previewList->selectionModel()->select(previewListModel->index(0, SIZE), QItemSelectionModel::Select); - previewList->selectionModel()->select(previewListModel->index(0, PROGRESS), QItemSelectionModel::Select); if (!previewListModel->rowCount()) { QMessageBox::critical(0, tr("Preview impossible"), tr("Sorry, we can't preview this file")); close(); @@ -86,6 +83,7 @@ PreviewSelect::PreviewSelect(QWidget* parent, QTorrentHandle h): QDialog(parent) connect(this, SIGNAL(readyToPreviewFile(QString)), parent, SLOT(previewFile(QString))); previewListModel->sort(NAME); previewList->header()->setSortIndicator(0, Qt::AscendingOrder); + previewList->selectionModel()->select(previewListModel->index(0, NAME), QItemSelectionModel::Select | QItemSelectionModel::Rows); if (previewListModel->rowCount() == 1) { qDebug("Torrent file only contains one file, no need to display selection dialog before preview"); @@ -104,7 +102,6 @@ PreviewSelect::~PreviewSelect() { void PreviewSelect::on_previewButton_clicked() { - QModelIndex index; QModelIndexList selectedIndexes = previewList->selectionModel()->selectedRows(FILE_INDEX); if (selectedIndexes.size() == 0) return; // Flush data