From 6ed807f52d7837e1e8e87a182ca053ca17f45b5b Mon Sep 17 00:00:00 2001 From: "Lubomir I. Ivanov" Date: Mon, 17 Jul 2017 22:59:14 +0300 Subject: 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 --- mobile-widgets/qmlmapwidgethelper.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'mobile-widgets/qmlmapwidgethelper.cpp') diff --git a/mobile-widgets/qmlmapwidgethelper.cpp b/mobile-widgets/qmlmapwidgethelper.cpp index c560c5aaf..7e653692a 100644 --- a/mobile-widgets/qmlmapwidgethelper.cpp +++ b/mobile-widgets/qmlmapwidgethelper.cpp @@ -29,12 +29,14 @@ void MapWidgetHelper::reloadMapLocations() struct dive_site *ds; int idx; m_mapLocationModel->clear(); + QList 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); } -- cgit v1.2.3-70-g09d2