diff options
Diffstat (limited to 'qt-models/divecomputermodel.cpp')
-rw-r--r-- | qt-models/divecomputermodel.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/qt-models/divecomputermodel.cpp b/qt-models/divecomputermodel.cpp index d0b9f7637..356e24ef8 100644 --- a/qt-models/divecomputermodel.cpp +++ b/qt-models/divecomputermodel.cpp @@ -113,3 +113,11 @@ bool DiveComputerSortedModel::lessThan(const QModelIndex &i1, const QModelIndex return sortHelper(i1, i2, DiveComputerModel::MODEL, DiveComputerModel::ID); } } + +void DiveComputerSortedModel::remove(const QModelIndex &index) +{ + int row = mapToSource(index).row(); + if (row < 0 || row >= (int)device_table.devices.size()) + return; + device_table.devices.erase(device_table.devices.begin() + row); +} |