Partially revert 3025e0630d

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>
This commit is contained in:
Berthold Stoeger 2019-11-15 16:47:21 +01:00 committed by Dirk Hohndel
parent 065559c3d8
commit 36094e4a18

View file

@ -169,15 +169,17 @@ QVariant DivePlotDataModel::headerData(int section, Qt::Orientation orientation,
void DivePlotDataModel::clear() void DivePlotDataModel::clear()
{ {
beginResetModel(); if (rowCount() != 0) {
pInfo.nr = 0; beginRemoveRows(QModelIndex(), 0, rowCount() - 1);
free(pInfo.entry); pInfo.nr = 0;
free(pInfo.pressures); free(pInfo.entry);
pInfo.entry = nullptr; free(pInfo.pressures);
pInfo.pressures = nullptr; pInfo.entry = nullptr;
diveId = -1; pInfo.pressures = nullptr;
dcNr = -1; diveId = -1;
endResetModel(); dcNr = -1;
endRemoveRows();
}
} }
void DivePlotDataModel::setDive(dive *d, const plot_info &info) void DivePlotDataModel::setDive(dive *d, const plot_info &info)