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.

(cherry-picked from 82d465c)
  • Loading branch information
nyalldawson committed May 19, 2016
1 parent a2756b9 commit e63e9eb
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/app/qgisapp.cpp
Expand Up @@ -1574,14 +1574,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 e63e9eb

Please sign in to comment.