26
26
#include " qgstextannotationitem.h"
27
27
#include " qgssvgannotationdialog.h"
28
28
#include " qgssvgannotationitem.h"
29
+ #include " qgsproject.h"
29
30
#include < QDialog>
30
31
#include < QMouseEvent>
31
32
@@ -141,6 +142,7 @@ void QgsMapToolAnnotation::keyPressEvent( QKeyEvent* e )
141
142
mCanvas ->scene ()->removeItem ( sItem );
142
143
delete sItem ;
143
144
mCanvas ->setCursor ( neutralCursor );
145
+ QgsProject::instance ()->setDirty ( true ); // TODO QGIS3: Rework the whole annotation code to be MVC compliant, see PR #2506
144
146
145
147
// Override default shortcut management in MapCanvas
146
148
e->ignore ();
@@ -158,6 +160,7 @@ void QgsMapToolAnnotation::canvasMoveEvent( QgsMapMouseEvent* e )
158
160
{
159
161
sItem ->setMapPosition ( toMapCoordinates ( e->pos () ) );
160
162
sItem ->update ();
163
+ QgsProject::instance ()->setDirty ( true );
161
164
}
162
165
else if ( mCurrentMoveAction == QgsAnnotationItem::MoveFramePosition )
163
166
{
@@ -171,6 +174,7 @@ void QgsMapToolAnnotation::canvasMoveEvent( QgsMapMouseEvent* e )
171
174
sItem ->setMapPosition ( toMapCoordinates ( newCanvasPos.toPoint () ) );
172
175
}
173
176
sItem ->update ();
177
+ QgsProject::instance ()->setDirty ( true );
174
178
}
175
179
else if ( mCurrentMoveAction != QgsAnnotationItem::NoAction )
176
180
{
@@ -220,6 +224,7 @@ void QgsMapToolAnnotation::canvasMoveEvent( QgsMapMouseEvent* e )
220
224
sItem ->setOffsetFromReferencePoint ( QPointF ( xmin, ymin ) );
221
225
sItem ->setFrameSize ( QSizeF ( xmax - xmin, ymax - ymin ) );
222
226
sItem ->update ();
227
+ QgsProject::instance ()->setDirty ( true );
223
228
}
224
229
}
225
230
else if ( sItem )
@@ -243,7 +248,8 @@ void QgsMapToolAnnotation::canvasDoubleClickEvent( QgsMapMouseEvent* e )
243
248
QDialog* itemEditor = createItemEditor ( item );
244
249
if ( itemEditor )
245
250
{
246
- itemEditor->exec ();
251
+ if ( itemEditor->exec () )
252
+ QgsProject::instance ()->setDirty ( true );
247
253
delete itemEditor;
248
254
}
249
255
}
0 commit comments