Skip to content

Commit

Permalink
Remove action for creating old text annotations
Browse files Browse the repository at this point in the history
The new Text in Rect annotation item should be used instead
  • Loading branch information
nyalldawson committed Aug 19, 2024
1 parent 45be3ee commit 2738289
Show file tree
Hide file tree
Showing 8 changed files with 3 additions and 102 deletions.
1 change: 0 additions & 1 deletion src/app/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ set(QGIS_APP_SRCS
qgsmaptoolsimplify.cpp
qgsmaptoolsplitfeatures.cpp
qgsmaptoolsplitparts.cpp
qgsmaptooltextannotation.cpp

annotations/qgsannotationitempropertieswidget.cpp
annotations/qgsannotationlayerproperties.cpp
Expand Down
2 changes: 0 additions & 2 deletions src/app/maptools/qgsappmaptools.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
#include "qgsmaptoolpan.h"
#include "qgsmaptoolfeatureaction.h"
#include "qgsmeasuretool.h"
#include "qgsmaptooltextannotation.h"
#include "qgsmaptoolhtmlannotation.h"
#include "qgsmaptoolmeasureangle.h"
#include "qgsmaptoolmeasurebearing.h"
Expand Down Expand Up @@ -70,7 +69,6 @@ QgsAppMapTools::QgsAppMapTools( QgsMapCanvas *canvas, QgsAdvancedDigitizingDockW
mTools.insert( Tool::MeasureArea, new QgsMeasureTool( canvas, true /* area */ ) );
mTools.insert( Tool::MeasureAngle, new QgsMapToolMeasureAngle( canvas ) );
mTools.insert( Tool::MeasureBearing, new QgsMapToolMeasureBearing( canvas ) );
mTools.insert( Tool::TextAnnotation, new QgsMapToolTextAnnotation( canvas ) );
mTools.insert( Tool::FormAnnotation, new QgsMapToolFormAnnotation( canvas ) );
mTools.insert( Tool::HtmlAnnotation, new QgsMapToolHtmlAnnotation( canvas ) );
mTools.insert( Tool::AddFeature, new QgsMapToolAddFeature( canvas, cadDock, QgsMapToolCapture::CaptureNone ) );
Expand Down
1 change: 0 additions & 1 deletion src/app/maptools/qgsappmaptools.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ class QgsAppMapTools
Annotation, // Unused
FormAnnotation,
HtmlAnnotation,
TextAnnotation,
PinLabels,
ShowHideLabels,
MoveLabel,
Expand Down
20 changes: 3 additions & 17 deletions src/app/qgisapp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3021,7 +3021,6 @@ void QgisApp::createActions()
connect( mActionMapTips, &QAction::toggled, this, &QgisApp::toggleMapTips );
connect( mActionNewBookmark, &QAction::triggered, this, [ = ] { newBookmark( true ); } );
connect( mActionDraw, &QAction::triggered, this, [this] { refreshMapCanvas( true ); } );
connect( mActionTextAnnotation, &QAction::triggered, this, &QgisApp::addTextAnnotation );
connect( mActionFormAnnotation, &QAction::triggered, this, &QgisApp::addFormAnnotation );
connect( mActionHtmlAnnotation, &QAction::triggered, this, &QgisApp::addHtmlAnnotation );
connect( mActionLabeling, &QAction::triggered, this, &QgisApp::labeling );
Expand Down Expand Up @@ -3966,22 +3965,18 @@ void QgisApp::createToolBars()

bt = new QToolButton();
bt->setPopupMode( QToolButton::MenuButtonPopup );
bt->addAction( mActionTextAnnotation );
bt->addAction( mActionFormAnnotation );
bt->addAction( mActionHtmlAnnotation );

QAction *defAnnotationAction = mActionTextAnnotation;
QAction *defAnnotationAction = mActionHtmlAnnotation;
switch ( settings.value( QStringLiteral( "UI/annotationTool" ), 0 ).toInt() )
{
case 0:
defAnnotationAction = mActionTextAnnotation;
defAnnotationAction = mActionHtmlAnnotation;
break;
case 1:
defAnnotationAction = mActionFormAnnotation;
break;
case 2:
defAnnotationAction = mActionHtmlAnnotation;
break;
}
bt->setDefaultAction( defAnnotationAction );
QAction *annotationAction = mAnnotationsToolBar->addWidget( bt );
Expand Down Expand Up @@ -4359,7 +4354,6 @@ void QgisApp::setTheme( const QString &themeName )
mActionAddToOverview->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionInOverview.svg" ) ) );
mActionFormAnnotation->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionFormAnnotation.svg" ) ) );
mActionHtmlAnnotation->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionHtmlAnnotation.svg" ) ) );
mActionTextAnnotation->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionTextAnnotation.svg" ) ) );
mActionLabeling->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionLabeling.svg" ) ) );
mActionShowPinnedLabels->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionShowPinnedLabels.svg" ) ) );
mActionPinLabels->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionPinLabels.svg" ) ) );
Expand Down Expand Up @@ -4579,7 +4573,6 @@ void QgisApp::setupCanvasTools()
mMapTools->mapTool( QgsAppMapTools::MeasureArea )->setAction( mActionMeasureArea );
mMapTools->mapTool( QgsAppMapTools::MeasureAngle )->setAction( mActionMeasureAngle );
mMapTools->mapTool( QgsAppMapTools::MeasureBearing )->setAction( mActionMeasureBearing );
mMapTools->mapTool( QgsAppMapTools::TextAnnotation )->setAction( mActionTextAnnotation );
mMapTools->mapTool( QgsAppMapTools::FormAnnotation )->setAction( mActionFormAnnotation );
mMapTools->mapTool( QgsAppMapTools::HtmlAnnotation )->setAction( mActionHtmlAnnotation );
mMapTools->mapTool( QgsAppMapTools::AddFeature )->setAction( mActionAddFeature );
Expand Down Expand Up @@ -7933,11 +7926,6 @@ void QgisApp::addHtmlAnnotation()
mMapCanvas->setMapTool( mMapTools->mapTool( QgsAppMapTools::HtmlAnnotation ) );
}

void QgisApp::addTextAnnotation()
{
mMapCanvas->setMapTool( mMapTools->mapTool( QgsAppMapTools::TextAnnotation ) );
}

void QgisApp::reprojectAnnotations()
{
const auto annotations = annotationItems();
Expand Down Expand Up @@ -17015,12 +17003,10 @@ void QgisApp::toolButtonActionTriggered( QAction *action )
settings.setValue( QStringLiteral( "UI/measureTool" ), 1 );
else if ( action == mActionMeasureAngle )
settings.setValue( QStringLiteral( "UI/measureTool" ), 2 );
else if ( action == mActionTextAnnotation )
settings.setValue( QStringLiteral( "UI/annotationTool" ), 0 );
else if ( action == mActionFormAnnotation )
settings.setValue( QStringLiteral( "UI/annotationTool" ), 1 );
else if ( action == mActionHtmlAnnotation )
settings.setValue( QStringLiteral( "UI/annotationTool" ), 2 );
settings.setValue( QStringLiteral( "UI/annotationTool" ), 0 );
else if ( action == mActionNewSpatiaLiteLayer )
settings.setValue( QStringLiteral( "UI/defaultNewLayer" ), 0 );
else if ( action == mActionNewVectorLayer )
Expand Down
1 change: 0 additions & 1 deletion src/app/qgisapp.h
Original file line number Diff line number Diff line change
Expand Up @@ -1947,7 +1947,6 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow

//annotations
void addFormAnnotation();
void addTextAnnotation();
void addHtmlAnnotation();
void reprojectAnnotations();

Expand Down
32 changes: 0 additions & 32 deletions src/app/qgsmaptooltextannotation.cpp

This file was deleted.

35 changes: 0 additions & 35 deletions src/app/qgsmaptooltextannotation.h

This file was deleted.

13 changes: 0 additions & 13 deletions src/ui/qgisapp.ui
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,6 @@
<property name="title">
<string>Add Annotation</string>
</property>
<addaction name="mActionTextAnnotation"/>
<addaction name="mActionFormAnnotation"/>
<addaction name="mActionHtmlAnnotation"/>
</widget>
Expand Down Expand Up @@ -1506,18 +1505,6 @@ Shift+O to turn segments into straight or curve lines.</string>
<string>F5</string>
</property>
</action>
<action name="mActionTextAnnotation">
<property name="checkable">
<bool>true</bool>
</property>
<property name="icon">
<iconset resource="../../images/images.qrc">
<normaloff>:/images/themes/default/mActionTextAnnotation.svg</normaloff>:/images/themes/default/mActionTextAnnotation.svg</iconset>
</property>
<property name="text">
<string>Text Annotation</string>
</property>
</action>
<action name="mActionFormAnnotation">
<property name="checkable">
<bool>true</bool>
Expand Down

0 comments on commit 2738289

Please sign in to comment.