diff options
author | Tomaz Canabrava <tomaz.canabrava@gmail.com> | 2015-05-31 17:47:34 -0300 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2015-05-31 16:01:46 -0700 |
commit | 7129cef66fa4d335d70e6d64ce9cb03f89b3610f (patch) | |
tree | c647a16b6cb8d03cc7a6ef687d7dc5fc8aa30f10 /qt-models | |
parent | b35e48c68e861039e338597f3c258ede7812c175 (diff) | |
download | subsurface-7129cef66fa4d335d70e6d64ce9cb03f89b3610f.tar.gz |
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>
Diffstat (limited to 'qt-models')
-rw-r--r-- | qt-models/divelocationmodel.cpp | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/qt-models/divelocationmodel.cpp b/qt-models/divelocationmodel.cpp index a2b5606b7..21c3127ca 100644 --- a/qt-models/divelocationmodel.cpp +++ b/qt-models/divelocationmodel.cpp @@ -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(); } } |