https://issues.qgis.org/https://issues.qgis.org/favicon.ico2016-05-16T10:33:42ZQGIS Issue TrackingQGIS Application - Bug report #14812: Saving / re-openning a project reverse the annotations z-orderhttps://issues.qgis.org/issues/14812?journal_id=699962016-05-16T10:33:42ZSimon Chenerysimonff1@yahoo.com
<ul><li><strong>File</strong> <a href="/attachments/download/9928/14812.patch.txt">14812.patch.txt</a><a href="/attachments/9928/14812.patch.txt"><img alt="Magnifier" src="/images/magnifier.png" /></a> added</li></ul><p>If I create three Text Annotations 'Annotation1', 'Annotation2' and 'Annotation3' and save the project, then the Text Annotations are saved in order 'Annotation3', 'Annotation2', 'Annotation1' in the project.qgs file.</p>
<p>This is because QgsMapCanvas::items() (from parent class QGraphicsView::items()) returns the items in "stacking order" with the uppermost item 'Annotation3' first, and QgisApp::writeAnnotationItemsToProject saves the Text Annotations in this order too.</p>
<p>When I load the project again, 'Annotation1' is now on top, although it was on the bottom before.</p>
<p>Solution is to go through the QgsAnnotationItem list in reverse order when saving the project.qgs file -- this logic is already used in QgsMapCanvas::saveAsImage for creating an image file.</p>
<p>A master patch is attached (git diff --patch > /tmp/14812.patch.txt).</p> QGIS Application - Bug report #14812: Saving / re-openning a project reverse the annotations z-orderhttps://issues.qgis.org/issues/14812?journal_id=699972016-05-16T11:24:57ZSimon Chenerysimonff1@yahoo.com
<ul></ul><p>Also created a pull request <a class="external" href="https://github.com/qgis/QGIS/pull/3074">https://github.com/qgis/QGIS/pull/3074</a></p> QGIS Application - Bug report #14812: Saving / re-openning a project reverse the annotations z-orderhttps://issues.qgis.org/issues/14812?journal_id=700032016-05-17T15:09:18ZSimon Chenery
<ul><li><strong>Status</strong> changed from <i>Open</i> to <i>Closed</i></li></ul><p>Fixed in changeset <a class="changeset" href="https://issues.qgis.org/projects/qgis/repository/revisions/82d465cd9434d4445fe4fa44af8a5fd085cbc566" title="Save annotations to project.qgs in creation order (fix #14812) Save annotations to project file ...">82d465cd9434d4445fe4fa44af8a5fd085cbc566</a>.</p>