Skip to content
Permalink
Browse files

Save annotations to project.qgs in creation order (fix #14812)

Save annotations to project file in the order they were loaded or
created, so that annotations have the same display order each
time the project is opened.
  • Loading branch information
simoc authored and nyalldawson committed May 18, 2016
1 parent 0ff10ae commit 82d465cd9434d4445fe4fa44af8a5fd085cbc566
Showing with 9 additions and 4 deletions.
  1. +9 −4 src/app/qgisapp.cpp
@@ -1604,14 +1604,19 @@ void QgisApp::showStyleManagerV2()
void QgisApp::writeAnnotationItemsToProject( QDomDocument& doc )
{
QList<QgsAnnotationItem*> items = annotationItems();
QList<QgsAnnotationItem*>::const_iterator itemIt = items.constBegin();
for ( ; itemIt != items.constEnd(); ++itemIt )
QgsAnnotationItem* item;
QListIterator<QgsAnnotationItem*> i( items );
// save lowermost annotation (at end of list) first
i.toBack();
while ( i.hasPrevious() )
{
if ( ! *itemIt )
item = i.previous();

if ( ! item )
{
continue;
}
( *itemIt )->writeXML( doc );
item->writeXML( doc );
}
}

0 comments on commit 82d465c

Please sign in to comment.