mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-20 06:45:27 +00:00
Dive d/l selection UI: fix more array access errors
The checked array is zero based, reflecting the rows shown. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
32824e8db8
commit
d16bff13bb
1 changed files with 2 additions and 2 deletions
|
@ -570,7 +570,7 @@ QVariant DiveImportedModel::data(const QModelIndex &index, int role) const
|
|||
}
|
||||
if (role == Qt::CheckStateRole) {
|
||||
if (index.column() == 0)
|
||||
return checkStates[index.row() + firstIndex] ? Qt::Checked : Qt::Unchecked;
|
||||
return checkStates[index.row()] ? Qt::Checked : Qt::Unchecked;
|
||||
}
|
||||
return QVariant();
|
||||
}
|
||||
|
@ -586,7 +586,7 @@ bool DiveImportedModel::setData(const QModelIndex &index, const QVariant &value,
|
|||
if (role != Qt::CheckStateRole)
|
||||
return false;
|
||||
|
||||
checkStates[index.row() + firstIndex] = value.toBool();
|
||||
checkStates[index.row()] = value.toBool();
|
||||
dataChanged(index, index, QVector<int>() << Qt::CheckStateRole);
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue