mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Dive list: remove global pointer to DiveTrip model
This part of the code had that horrible pattern, where reseting the model would invalidate all pointers to the DiveTrip model. Internalize these complexities in the MultiFilterSortModel. All accesses are now performed via that proxy model. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
0f417a3bc1
commit
6ec82a3c80
4 changed files with 16 additions and 41 deletions
|
@ -357,22 +357,6 @@ QVariant DiveTripModelBase::headerData(int section, Qt::Orientation orientation,
|
|||
return QVariant();
|
||||
}
|
||||
|
||||
static std::unique_ptr<DiveTripModelBase> currentModel;
|
||||
DiveTripModelBase *DiveTripModelBase::instance()
|
||||
{
|
||||
if (!currentModel)
|
||||
resetModel(TREE);
|
||||
return currentModel.get();
|
||||
}
|
||||
|
||||
void DiveTripModelBase::resetModel(DiveTripModelBase::Layout layout)
|
||||
{
|
||||
if (layout == TREE)
|
||||
currentModel.reset(new DiveTripModelTree);
|
||||
else
|
||||
currentModel.reset(new DiveTripModelList);
|
||||
}
|
||||
|
||||
// After resetting the model, the higher up model or view may call this
|
||||
// function to get informed on the current selection.
|
||||
// TODO: Currently, this reads and resets the selection. Make this more
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue