Browse Source

- Fixed index problem in preview selection (closes #192495)

adaptive-webui-19844
Christophe Dumez 17 years ago
parent
commit
34725dc26b
  1. 4
      src/previewSelect.h

4
src/previewSelect.h

@ -45,6 +45,7 @@ class previewSelect: public QDialog, private Ui::preview {
QStandardItemModel *previewListModel; QStandardItemModel *previewListModel;
PreviewListDelegate *listDelegate; PreviewListDelegate *listDelegate;
QTorrentHandle h; QTorrentHandle h;
QList<int> indexes;
signals: signals:
void readyToPreviewFile(QString) const; void readyToPreviewFile(QString) const;
@ -57,7 +58,7 @@ class previewSelect: public QDialog, private Ui::preview {
QString path; QString path;
foreach(index, selectedIndexes){ foreach(index, selectedIndexes){
if(index.column() == NAME){ if(index.column() == NAME){
path = h.files_path().at(index.row()); path = h.files_path().at(indexes.at(index.row()));
// File // File
if(QFile::exists(path)){ if(QFile::exists(path)){
emit readyToPreviewFile(path); emit readyToPreviewFile(path);
@ -101,6 +102,7 @@ class previewSelect: public QDialog, private Ui::preview {
previewListModel->setData(previewListModel->index(row, NAME), QVariant(fileName)); previewListModel->setData(previewListModel->index(row, NAME), QVariant(fileName));
previewListModel->setData(previewListModel->index(row, SIZE), QVariant((qlonglong)h.filesize_at(i))); previewListModel->setData(previewListModel->index(row, SIZE), QVariant((qlonglong)h.filesize_at(i)));
previewListModel->setData(previewListModel->index(row, PROGRESS), QVariant((double)fp[i])); previewListModel->setData(previewListModel->index(row, PROGRESS), QVariant((double)fp[i]));
indexes << i;
} }
} }
previewList->selectionModel()->select(previewListModel->index(0, NAME), QItemSelectionModel::Select); previewList->selectionModel()->select(previewListModel->index(0, NAME), QItemSelectionModel::Select);

Loading…
Cancel
Save