summaryrefslogtreecommitdiffstats
path: root/qt-models/maplocationmodel.cpp
diff options
context:
space:
mode:
authorGravatar Lubomir I. Ivanov <neolit123@gmail.com>2017-07-17 22:59:14 +0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2017-07-28 07:31:11 -0700
commit6ed807f52d7837e1e8e87a182ca053ca17f45b5b (patch)
tree19f04e5ad9029b5a66a01e80cba03e54634ae736 /qt-models/maplocationmodel.cpp
parent8fe068f1915f91bb3d9463874515db7f83145d8a (diff)
downloadsubsurface-6ed807f52d7837e1e8e87a182ca053ca17f45b5b.tar.gz
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>
Diffstat (limited to 'qt-models/maplocationmodel.cpp')
-rw-r--r--qt-models/maplocationmodel.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/qt-models/maplocationmodel.cpp b/qt-models/maplocationmodel.cpp
index d08e7020c..ec554d004 100644
--- a/qt-models/maplocationmodel.cpp
+++ b/qt-models/maplocationmodel.cpp
@@ -68,6 +68,15 @@ void MapLocationModel::add(MapLocation *location)
endInsertRows();
}
+void MapLocationModel::addList(QList<MapLocation *> list)
+{
+ if (!list.size())
+ return;
+ beginInsertRows(QModelIndex(), m_mapLocations.size(), m_mapLocations.size() + list.size() - 1);
+ m_mapLocations.append(list);
+ endInsertRows();
+}
+
void MapLocationModel::clear()
{
if (!m_mapLocations.size())