Skip to content

Commit

Permalink
[layouts] hide atlas/report items in the window right-click menu
Browse files Browse the repository at this point in the history
  • Loading branch information
nirvn committed Feb 19, 2018
1 parent 8fd35c3 commit 6995671
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/app/layout/qgslayoutdesignerdialog.cpp
Expand Up @@ -793,6 +793,11 @@ QMenu *QgsLayoutDesignerDialog::createPopupMenu()
menu->addAction( panelstitle );
Q_FOREACH ( QAction *a, panels )
{
if ( ( a == mAtlasDock->toggleViewAction() && !dynamic_cast< QgsPrintLayout * >( mMasterLayout ) ) ||
( a == mReportDock->toggleViewAction() && !dynamic_cast< QgsReport * >( mMasterLayout ) ) )
{
a->setVisible( false );
}
menu->addAction( a );
}
menu->addSeparator();
Expand All @@ -805,6 +810,11 @@ QMenu *QgsLayoutDesignerDialog::createPopupMenu()
std::sort( toolbars.begin(), toolbars.end(), cmpByText_ );
Q_FOREACH ( QAction *a, toolbars )
{
if ( ( a == mAtlasToolbar->toggleViewAction() && !dynamic_cast< QgsPrintLayout * >( mMasterLayout ) ) ||
( a == mReportToolbar->toggleViewAction() && !dynamic_cast< QgsReport * >( mMasterLayout ) ) )
{
a->setVisible( false );
}
menu->addAction( a );
}
}
Expand Down Expand Up @@ -851,6 +861,7 @@ void QgsLayoutDesignerDialog::setMasterLayout( QgsMasterLayoutInterface *layout
delete mMenuAtlas;
mMenuAtlas = nullptr;
mAtlasToolbar->hide();
mToolbarMenu->removeAction( mAtlasToolbar->toggleViewAction() );
}

if ( dynamic_cast< QgsReport * >( layout ) )
Expand All @@ -867,6 +878,7 @@ void QgsLayoutDesignerDialog::setMasterLayout( QgsMasterLayoutInterface *layout
delete mMenuReport;
mMenuReport = nullptr;
mReportToolbar->hide();
mToolbarMenu->removeAction( mReportToolbar->toggleViewAction() );
}

updateActionNames( mMasterLayout->layoutType() );
Expand Down

0 comments on commit 6995671

Please sign in to comment.