summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2019-11-15 16:47:21 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2019-11-16 08:29:53 -0800
commit36094e4a188a922eba6f83e5a30c8c575c462b84 (patch)
tree6beaceeb95776ac800dff7d53b74bb907a0c1095
parent065559c3d8194ee8ac2a251091eddb5da803d105 (diff)
downloadsubsurface-36094e4a188a922eba6f83e5a30c8c575c462b84.tar.gz
This commit did the "right" thing by implementing Qt mode semantics as intended, but for unknown reasons the profile is not properly cleared on close-file anymore. This code is so convoluted that there is not point in fighting it at the moment. Revert to remove-rows instead of reset-model. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
-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)