Cleanup: make DiveTripModel a global object

DiveTripModel (the model describing the dive-list) was destroyed
and recreated on every reset of the list. This seems excessive.
Instead - in analogy to most other models - make it a single
global object.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2018-07-25 21:23:19 +02:00 committed by Dirk Hohndel
parent 236f0512be
commit 89e0c3f464
7 changed files with 31 additions and 28 deletions

View file

@ -187,7 +187,7 @@ void YearlyStatisticsModel::update_yearly_stats()
month++;
}
rootItem->children.append(item);
item->parent = rootItem;
item->parent = rootItem.get();
}
@ -199,7 +199,7 @@ void YearlyStatisticsModel::update_yearly_stats()
iChild->parent = item;
}
rootItem->children.append(item);
item->parent = rootItem;
item->parent = rootItem.get();
}
/* Show the statistic sorted by dive type */
@ -213,6 +213,6 @@ void YearlyStatisticsModel::update_yearly_stats()
iChild->parent = item;
}
rootItem->children.append(item);
item->parent = rootItem;
item->parent = rootItem.get();
}
}