Skip to content

Commit

Permalink
Save annotations to project.qgs in creation order (fix #14812)
Browse files Browse the repository at this point in the history
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 82d465c
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/app/qgisapp.cpp
Expand Up @@ -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 );
}
}

Expand Down

0 comments on commit 82d465c

Please sign in to comment.