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
|
@ -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())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue