summaryrefslogtreecommitdiffstats
path: root/qt-models
diff options
context:
space:
mode:
Diffstat (limited to 'qt-models')
-rw-r--r--qt-models/diveplotdatamodel.cpp20
1 files changed, 11 insertions, 9 deletions
diff --git a/qt-models/diveplotdatamodel.cpp b/qt-models/diveplotdatamodel.cpp
index eed13c501..efa6147c2 100644
--- a/qt-models/diveplotdatamodel.cpp
+++ b/qt-models/diveplotdatamodel.cpp
@@ -169,15 +169,17 @@ QVariant DivePlotDataModel::headerData(int section, Qt::Orientation orientation,
void DivePlotDataModel::clear()
{
- beginResetModel();
- pInfo.nr = 0;
- free(pInfo.entry);
- free(pInfo.pressures);
- pInfo.entry = nullptr;
- pInfo.pressures = nullptr;
- diveId = -1;
- dcNr = -1;
- endResetModel();
+ if (rowCount() != 0) {
+ beginRemoveRows(QModelIndex(), 0, rowCount() - 1);
+ pInfo.nr = 0;
+ free(pInfo.entry);
+ free(pInfo.pressures);
+ pInfo.entry = nullptr;
+ pInfo.pressures = nullptr;
+ diveId = -1;
+ dcNr = -1;
+ endRemoveRows();
+ }
}
void DivePlotDataModel::setDive(dive *d, const plot_info &info)