Skip to content

Commit

Permalink
Merge pull request #2506 from SebDieBln/MakeDirtyOnAnnotation
Browse files Browse the repository at this point in the history
changes to annotations mark the project dirty (fixes #7586)
  • Loading branch information
m-kuhn committed Nov 30, 2015
2 parents 4ea0c56 + 30d7795 commit a792a47
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/app/qgsmaptoolannotation.cpp
Expand Up @@ -26,6 +26,7 @@
#include "qgstextannotationitem.h"
#include "qgssvgannotationdialog.h"
#include "qgssvgannotationitem.h"
#include "qgsproject.h"
#include <QDialog>
#include <QMouseEvent>

Expand Down Expand Up @@ -141,6 +142,7 @@ void QgsMapToolAnnotation::keyPressEvent( QKeyEvent* e )
mCanvas->scene()->removeItem( sItem );
delete sItem;
mCanvas->setCursor( neutralCursor );
QgsProject::instance()->setDirty( true ); // TODO QGIS3: Rework the whole annotation code to be MVC compliant, see PR #2506

// Override default shortcut management in MapCanvas
e->ignore();
Expand All @@ -158,6 +160,7 @@ void QgsMapToolAnnotation::canvasMoveEvent( QgsMapMouseEvent* e )
{
sItem->setMapPosition( toMapCoordinates( e->pos() ) );
sItem->update();
QgsProject::instance()->setDirty( true );
}
else if ( mCurrentMoveAction == QgsAnnotationItem::MoveFramePosition )
{
Expand All @@ -171,6 +174,7 @@ void QgsMapToolAnnotation::canvasMoveEvent( QgsMapMouseEvent* e )
sItem->setMapPosition( toMapCoordinates( newCanvasPos.toPoint() ) );
}
sItem->update();
QgsProject::instance()->setDirty( true );
}
else if ( mCurrentMoveAction != QgsAnnotationItem::NoAction )
{
Expand Down Expand Up @@ -220,6 +224,7 @@ void QgsMapToolAnnotation::canvasMoveEvent( QgsMapMouseEvent* e )
sItem->setOffsetFromReferencePoint( QPointF( xmin, ymin ) );
sItem->setFrameSize( QSizeF( xmax - xmin, ymax - ymin ) );
sItem->update();
QgsProject::instance()->setDirty( true );
}
}
else if ( sItem )
Expand All @@ -243,7 +248,8 @@ void QgsMapToolAnnotation::canvasDoubleClickEvent( QgsMapMouseEvent* e )
QDialog* itemEditor = createItemEditor( item );
if ( itemEditor )
{
itemEditor->exec();
if ( itemEditor->exec() )
QgsProject::instance()->setDirty( true );
delete itemEditor;
}
}
Expand Down
2 changes: 2 additions & 0 deletions src/app/qgsmaptoolformannotation.cpp
Expand Up @@ -19,6 +19,7 @@
#include "qgsformannotationitem.h"
#include "qgsmapcanvas.h"
#include "qgsvectorlayer.h"
#include "qgsproject.h"
#include <QMouseEvent>

QgsMapToolFormAnnotation::QgsMapToolFormAnnotation( QgsMapCanvas* canvas ): QgsMapToolAnnotation( canvas )
Expand Down Expand Up @@ -48,6 +49,7 @@ QgsAnnotationItem* QgsMapToolFormAnnotation::createItem( QMouseEvent* e )
formItem->setMapPosition( toMapCoordinates( e->pos() ) );
formItem->setSelected( true );
formItem->setFrameSize( QSizeF( 200, 100 ) );
QgsProject::instance()->setDirty( true );
return formItem;
}

2 changes: 2 additions & 0 deletions src/app/qgsmaptoolhtmlannotation.cpp
Expand Up @@ -19,6 +19,7 @@
#include "qgshtmlannotationitem.h"
#include "qgsmapcanvas.h"
#include "qgsvectorlayer.h"
#include "qgsproject.h"
#include <QMouseEvent>

QgsMapToolHtmlAnnotation::QgsMapToolHtmlAnnotation( QgsMapCanvas* canvas ): QgsMapToolAnnotation( canvas )
Expand Down Expand Up @@ -48,6 +49,7 @@ QgsAnnotationItem* QgsMapToolHtmlAnnotation::createItem( QMouseEvent* e )
formItem->setMapPosition( toMapCoordinates( e->pos() ) );
formItem->setSelected( true );
formItem->setFrameSize( QSizeF( 200, 100 ) );
QgsProject::instance()->setDirty( true );
return formItem;
}

2 changes: 2 additions & 0 deletions src/app/qgsmaptoolsvgannotation.cpp
Expand Up @@ -17,6 +17,7 @@

#include "qgsmaptoolsvgannotation.h"
#include "qgssvgannotationitem.h"
#include "qgsproject.h"
#include <QMouseEvent>

QgsMapToolSvgAnnotation::QgsMapToolSvgAnnotation( QgsMapCanvas* canvas ): QgsMapToolAnnotation( canvas )
Expand All @@ -35,5 +36,6 @@ QgsAnnotationItem* QgsMapToolSvgAnnotation::createItem( QMouseEvent* e )
svgItem->setMapPosition( toMapCoordinates( e->pos() ) );
svgItem->setSelected( true );
svgItem->setFrameSize( QSizeF( 200, 100 ) );
QgsProject::instance()->setDirty( true );
return svgItem;
}
2 changes: 2 additions & 0 deletions src/app/qgsmaptooltextannotation.cpp
Expand Up @@ -17,6 +17,7 @@

#include "qgsmaptooltextannotation.h"
#include "qgstextannotationitem.h"
#include "qgsproject.h"
#include <QMouseEvent>

QgsMapToolTextAnnotation::QgsMapToolTextAnnotation( QgsMapCanvas* canvas ): QgsMapToolAnnotation( canvas )
Expand All @@ -36,6 +37,7 @@ QgsAnnotationItem* QgsMapToolTextAnnotation::createItem( QMouseEvent* e )
textItem->setMapPosition( toMapCoordinates( e->pos() ) );
textItem->setFrameSize( QSizeF( 200, 100 ) );
textItem->setSelected( true );
QgsProject::instance()->setDirty( true );
return textItem;
}

0 comments on commit a792a47

Please sign in to comment.