mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +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()
|
void LocationInformationModel::update()
|
||||||
{
|
{
|
||||||
int i;
|
|
||||||
struct dive_site *ds;
|
|
||||||
for_each_dive_site (i, ds);
|
|
||||||
|
|
||||||
if (rowCount()) {
|
if (rowCount()) {
|
||||||
beginRemoveRows(QModelIndex(), 0, rowCount()-1);
|
beginRemoveRows(QModelIndex(), 0, rowCount()-1);
|
||||||
endRemoveRows();
|
endRemoveRows();
|
||||||
}
|
}
|
||||||
if (i) {
|
if (dive_site_table.nr) {
|
||||||
beginInsertRows(QModelIndex(), 0, i-1);
|
beginInsertRows(QModelIndex(), 0, dive_site_table.nr);
|
||||||
internalRowCount = i-1;
|
internalRowCount = dive_site_table.nr;
|
||||||
endInsertRows();
|
endInsertRows();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue