Skip to content

Commit 6995671

Browse files
committed
[layouts] hide atlas/report items in the window right-click menu
1 parent 8fd35c3 commit 6995671

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/app/layout/qgslayoutdesignerdialog.cpp

+12
Original file line numberDiff line numberDiff line change
@@ -793,6 +793,11 @@ QMenu *QgsLayoutDesignerDialog::createPopupMenu()
793793
menu->addAction( panelstitle );
794794
Q_FOREACH ( QAction *a, panels )
795795
{
796+
if ( ( a == mAtlasDock->toggleViewAction() && !dynamic_cast< QgsPrintLayout * >( mMasterLayout ) ) ||
797+
( a == mReportDock->toggleViewAction() && !dynamic_cast< QgsReport * >( mMasterLayout ) ) )
798+
{
799+
a->setVisible( false );
800+
}
796801
menu->addAction( a );
797802
}
798803
menu->addSeparator();
@@ -805,6 +810,11 @@ QMenu *QgsLayoutDesignerDialog::createPopupMenu()
805810
std::sort( toolbars.begin(), toolbars.end(), cmpByText_ );
806811
Q_FOREACH ( QAction *a, toolbars )
807812
{
813+
if ( ( a == mAtlasToolbar->toggleViewAction() && !dynamic_cast< QgsPrintLayout * >( mMasterLayout ) ) ||
814+
( a == mReportToolbar->toggleViewAction() && !dynamic_cast< QgsReport * >( mMasterLayout ) ) )
815+
{
816+
a->setVisible( false );
817+
}
808818
menu->addAction( a );
809819
}
810820
}
@@ -851,6 +861,7 @@ void QgsLayoutDesignerDialog::setMasterLayout( QgsMasterLayoutInterface *layout
851861
delete mMenuAtlas;
852862
mMenuAtlas = nullptr;
853863
mAtlasToolbar->hide();
864+
mToolbarMenu->removeAction( mAtlasToolbar->toggleViewAction() );
854865
}
855866

856867
if ( dynamic_cast< QgsReport * >( layout ) )
@@ -867,6 +878,7 @@ void QgsLayoutDesignerDialog::setMasterLayout( QgsMasterLayoutInterface *layout
867878
delete mMenuReport;
868879
mMenuReport = nullptr;
869880
mReportToolbar->hide();
881+
mToolbarMenu->removeAction( mReportToolbar->toggleViewAction() );
870882
}
871883

872884
updateActionNames( mMasterLayout->layoutType() );

0 commit comments

Comments
 (0)