mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2024-11-22 09:16:05 +03:00
Fixed a crash when filtering all the files in a torrent
This commit is contained in:
parent
97aed61fc8
commit
4657ee9087
2 changed files with 13 additions and 0 deletions
|
@ -23,6 +23,7 @@
|
||||||
- BUGFIX: Progress column gets sorted on restart it is was during last execution
|
- BUGFIX: Progress column gets sorted on restart it is was during last execution
|
||||||
- BUGFIX: Made ETA more reliable using stats instead of instant values
|
- BUGFIX: Made ETA more reliable using stats instead of instant values
|
||||||
- BUGFIX: Remove torrent from hard drive used to delete parent folder if empty
|
- BUGFIX: Remove torrent from hard drive used to delete parent folder if empty
|
||||||
|
- BUGFIX: Fixed a crash when filtering all the files in a torrent
|
||||||
- COSMETIC: Redesigned torrent properties a little
|
- COSMETIC: Redesigned torrent properties a little
|
||||||
- COSMETIC: Redesigned options a little
|
- COSMETIC: Redesigned options a little
|
||||||
- COSMETIC: Display more logs messages concerning features
|
- COSMETIC: Display more logs messages concerning features
|
||||||
|
|
|
@ -143,6 +143,7 @@ class PropListDelegate: public QItemDelegate {
|
||||||
|
|
||||||
QWidget* createEditor(QWidget *parent, const QStyleOptionViewItem &/* option */, const QModelIndex & index) const {
|
QWidget* createEditor(QWidget *parent, const QStyleOptionViewItem &/* option */, const QModelIndex & index) const {
|
||||||
if(index.column() != PRIORITY) return 0;
|
if(index.column() != PRIORITY) return 0;
|
||||||
|
if(onlyOneItem(index)) return 0;
|
||||||
QComboBox* editor = new QComboBox(parent);
|
QComboBox* editor = new QComboBox(parent);
|
||||||
editor->setFocusPolicy(Qt::StrongFocus);
|
editor->setFocusPolicy(Qt::StrongFocus);
|
||||||
editor->addItem(tr("Ignored"));
|
editor->addItem(tr("Ignored"));
|
||||||
|
@ -183,6 +184,17 @@ class PropListDelegate: public QItemDelegate {
|
||||||
return textRect.size();
|
return textRect.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool onlyOneItem(const QModelIndex& index) const {
|
||||||
|
const QAbstractItemModel *model = index.model();
|
||||||
|
unsigned int nbRows = model->rowCount();
|
||||||
|
if(nbRows == (unsigned int)1) return true;
|
||||||
|
for(unsigned int i=0; i<nbRows; ++i){
|
||||||
|
if((unsigned int)index.row() == i) continue;
|
||||||
|
if(model->data(model->index(i, PRIORITY)).toInt()) return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const {
|
void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const {
|
||||||
QComboBox *combobox = static_cast<QComboBox*>(editor);
|
QComboBox *combobox = static_cast<QComboBox*>(editor);
|
||||||
|
|
Loading…
Reference in a new issue