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>
This commit is contained in:
Tomaz Canabrava 2015-06-04 00:05:05 -03:00 committed by Dirk Hohndel
parent 612b068e33
commit 09ca240c3e

View file

@ -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;
}