mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
maplocationmodel: add the addList() method
This method should be used if many markers are added at once. It's main purpose is to reduces the number of beingInsertRows() calls. Make MapWidgetHelper::reloadMapLocations() use it. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
This commit is contained in:
parent
8fe068f191
commit
6ed807f52d
3 changed files with 13 additions and 1 deletions
|
@ -29,12 +29,14 @@ void MapWidgetHelper::reloadMapLocations()
|
|||
struct dive_site *ds;
|
||||
int idx;
|
||||
m_mapLocationModel->clear();
|
||||
QList<MapLocation *> locationList;
|
||||
|
||||
for_each_dive_site(idx, ds) {
|
||||
if (!dive_site_has_gps_location(ds))
|
||||
continue;
|
||||
const qreal longitude = ds->longitude.udeg / 1000000.0;
|
||||
const qreal latitude = ds->latitude.udeg / 1000000.0;
|
||||
m_mapLocationModel->add(new MapLocation(QGeoCoordinate(latitude, longitude)));
|
||||
locationList.append(new MapLocation(QGeoCoordinate(latitude, longitude)));
|
||||
}
|
||||
m_mapLocationModel->addList(locationList);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue