Skip to content
Permalink
Browse files
[feature] Add "Main Annotation Layer Properties" option in the
annotation toolbar

This gives users access to setting properties for the main
annotation layer (the hidden one which always sits above all
other map layers), e.g. if they want to set the blend mode/opacity/
effect for this layer.
  • Loading branch information
nyalldawson committed Sep 10, 2021
1 parent ac66a8f commit 5295bf4ef9ae85fabfc1421a8725c8c96da1c454
Showing with 21 additions and 4 deletions.
  1. +13 −0 src/app/qgisapp.cpp
  2. +8 −4 src/ui/qgisapp.ui
@@ -2984,6 +2984,10 @@ void QgisApp::createActions()

connect( mActionCreateAnnotationLayer, &QAction::triggered, this, &QgisApp::createAnnotationLayer );
connect( mActionModifyAnnotation, &QAction::triggered, this, [ = ] { mMapCanvas->setMapTool( mMapTools->mapTool( QgsAppMapTools::AnnotationEdit ) ); } );
connect( mMainAnnotationLayerProperties, &QAction::triggered, this, [ = ]
{
showLayerProperties( QgsProject::instance()->mainAnnotationLayer() );
} );

// we can't set the shortcut these actions, because we need to restrict their context to the canvas and it's children..
for ( QWidget *widget :
@@ -3900,6 +3904,15 @@ void QgisApp::createToolBars()
for ( QAction *mapToolAction : editMeshMapTool->mapToolActions() )
mMapToolGroup->addAction( mapToolAction );
}

QToolButton *annotationLayerToolButton = new QToolButton();
annotationLayerToolButton->setPopupMode( QToolButton::MenuButtonPopup );
QMenu *annotationLayerMenu = new QMenu();
annotationLayerMenu->addAction( mActionCreateAnnotationLayer );
annotationLayerMenu->addAction( mMainAnnotationLayerProperties );
annotationLayerToolButton->setMenu( annotationLayerMenu );
annotationLayerToolButton->setDefaultAction( mActionCreateAnnotationLayer );
mAnnotationsToolBar->insertWidget( mAnnotationsToolBar->actions().at( 0 ), annotationLayerToolButton );
}

void QgisApp::createStatusBar()
@@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>1064</width>
<width>1277</width>
<height>506</height>
</rect>
</property>
@@ -16,7 +16,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>1064</width>
<width>1277</width>
<height>24</height>
</rect>
</property>
@@ -801,7 +801,6 @@
<attribute name="toolBarBreak">
<bool>false</bool>
</attribute>
<addaction name="mActionCreateAnnotationLayer"/>
<addaction name="mActionModifyAnnotation"/>
</widget>
<action name="mActionNewProject">
@@ -3564,7 +3563,7 @@ Shows placeholders for labels which could not be placed, e.g. due to overlaps wi
</action>
<action name="mActionNewMeshLayer">
<property name="icon">
<iconset>
<iconset resource="../../images/images.qrc">
<normaloff>:/images/themes/default/mActionNewMeshLayer.svg</normaloff>:/images/themes/default/mActionNewMeshLayer.svg</iconset>
</property>
<property name="text">
@@ -3610,6 +3609,11 @@ Shows placeholders for labels which could not be placed, e.g. due to overlaps wi
<string>Modify Annotations</string>
</property>
</action>
<action name="mMainAnnotationLayerProperties">
<property name="text">
<string>Main Annotation Layer Properties…</string>
</property>
</action>
</widget>
<resources>
<include location="../../images/images.qrc"/>

0 comments on commit 5295bf4

Please sign in to comment.