summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tomaz.canabrava@gmail.com>2015-06-04 00:05:05 -0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-06-03 21:38:19 -0700
commit09ca240c3ee41f8d8fb029873d63e301da37fc99 (patch)
tree7d8b0997c48a0fc7cba5a3e213d15e89988eefd1
parent612b068e33d0c7510e3bee0fd15aceff1f788841 (diff)
downloadsubsurface-09ca240c3ee41f8d8fb029873d63e301da37fc99.tar.gz
Do not reset the model when adding a new dive site
This makes insertion faster, and also it doesn't break the current selection in the QComboBox. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--qt-models/divelocationmodel.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/qt-models/divelocationmodel.cpp b/qt-models/divelocationmodel.cpp
index 3e17f4fe2..ea6efda95 100644
--- a/qt-models/divelocationmodel.cpp
+++ b/qt-models/divelocationmodel.cpp
@@ -54,8 +54,11 @@ int32_t LocationInformationModel::addDiveSite(const QString& name, int lon, int
latitude.udeg = lat;
longitude.udeg = lon;
+ beginInsertRows(QModelIndex(), dive_site_table.nr, dive_site_table.nr);
int32_t uuid = create_dive_site_with_gps(name.toUtf8().data(), latitude, longitude);
- update();
+ std::sort(dive_site_table.dive_sites, dive_site_table.dive_sites + dive_site_table.nr, dive_site_less_than);
+ internalRowCount = dive_site_table.nr;
+ endInsertRows();
return uuid;
}