Equipment edit: for some reason we need a local copy of index

Calling enableEdition appears to corrupt the index that is passed into
this slot.

This doesn't fix the problem that we can't edit the cylinder start and end
pressure of a manually added dive, but at least we no longer try to edit
and invalid index.

See #582

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2014-07-01 10:18:21 -07:00
parent 48e059c49d
commit 8bd16a7808

View file

@ -1083,14 +1083,16 @@ void MainTab::on_visibility_valueChanged(int value)
void MainTab::editCylinderWidget(const QModelIndex &index)
{
// we need a local copy or bad things happen when enableEdition() is called
QModelIndex editIndex = index;
if (cylindersModel->changed && editMode == NONE) {
enableEdition();
return;
}
if (index.isValid() && index.column() != CylindersModel::REMOVE) {
if (editIndex.isValid() && editIndex.column() != CylindersModel::REMOVE) {
if (editMode == NONE)
enableEdition();
ui.cylinders->edit(index);
ui.cylinders->edit(editIndex);
}
}