mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-28 00:17:30 -05:00
changes to annotations mark the project dirty (fixes #7586)
this includes adding, editing, moving, resizing and deleting
This commit is contained in:
parent
5387fd1d51
commit
30d7795ff3
@ -26,6 +26,7 @@
|
||||
#include "qgstextannotationitem.h"
|
||||
#include "qgssvgannotationdialog.h"
|
||||
#include "qgssvgannotationitem.h"
|
||||
#include "qgsproject.h"
|
||||
#include <QDialog>
|
||||
#include <QMouseEvent>
|
||||
|
||||
@ -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();
|
||||
@ -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 )
|
||||
{
|
||||
@ -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 )
|
||||
{
|
||||
@ -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 )
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include "qgsformannotationitem.h"
|
||||
#include "qgsmapcanvas.h"
|
||||
#include "qgsvectorlayer.h"
|
||||
#include "qgsproject.h"
|
||||
#include <QMouseEvent>
|
||||
|
||||
QgsMapToolFormAnnotation::QgsMapToolFormAnnotation( QgsMapCanvas* canvas ): QgsMapToolAnnotation( canvas )
|
||||
@ -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;
|
||||
}
|
||||
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include "qgshtmlannotationitem.h"
|
||||
#include "qgsmapcanvas.h"
|
||||
#include "qgsvectorlayer.h"
|
||||
#include "qgsproject.h"
|
||||
#include <QMouseEvent>
|
||||
|
||||
QgsMapToolHtmlAnnotation::QgsMapToolHtmlAnnotation( QgsMapCanvas* canvas ): QgsMapToolAnnotation( canvas )
|
||||
@ -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;
|
||||
}
|
||||
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
#include "qgsmaptoolsvgannotation.h"
|
||||
#include "qgssvgannotationitem.h"
|
||||
#include "qgsproject.h"
|
||||
#include <QMouseEvent>
|
||||
|
||||
QgsMapToolSvgAnnotation::QgsMapToolSvgAnnotation( QgsMapCanvas* canvas ): QgsMapToolAnnotation( canvas )
|
||||
@ -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;
|
||||
}
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
#include "qgsmaptooltextannotation.h"
|
||||
#include "qgstextannotationitem.h"
|
||||
#include "qgsproject.h"
|
||||
#include <QMouseEvent>
|
||||
|
||||
QgsMapToolTextAnnotation::QgsMapToolTextAnnotation( QgsMapCanvas* canvas ): QgsMapToolAnnotation( canvas )
|
||||
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user