mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-31 19:23:24 +00:00
Don't calculate what we already have
We already have the correct number of dive_sites, why use a loop to calculate it? Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
b35e48c68e
commit
7129cef66f
1 changed files with 3 additions and 6 deletions
|
@ -33,17 +33,14 @@ QVariant LocationInformationModel::data(const QModelIndex &index, int role) cons
|
|||
|
||||
void LocationInformationModel::update()
|
||||
{
|
||||
int i;
|
||||
struct dive_site *ds;
|
||||
for_each_dive_site (i, ds);
|
||||
|
||||
if (rowCount()) {
|
||||
beginRemoveRows(QModelIndex(), 0, rowCount()-1);
|
||||
endRemoveRows();
|
||||
}
|
||||
if (i) {
|
||||
beginInsertRows(QModelIndex(), 0, i-1);
|
||||
internalRowCount = i-1;
|
||||
if (dive_site_table.nr) {
|
||||
beginInsertRows(QModelIndex(), 0, dive_site_table.nr);
|
||||
internalRowCount = dive_site_table.nr;
|
||||
endInsertRows();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue