Skip to content

Commit adb5b48

Browse files
author
g_j_m
committedOct 11, 2006
Provide menu options to view and hide the toolbars. This provides a
way out of the pickle that one can get into if one hides all of the toolbars (there was then no way to get them back with the gui). Due to the lack of a listToolbars() function for QMainWindow, there is no way to get a list of all of the toolbars that an application has, so toolbars that are added by the plugins, for example, aren't able to be controlled using these changes. git-svn-id: http://svn.osgeo.org/qgis/trunk@5938 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent a62d1bf commit adb5b48

File tree

2 files changed

+51
-1
lines changed

2 files changed

+51
-1
lines changed
 

‎src/gui/qgisapp.cpp

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -572,6 +572,18 @@ void QgisApp::createActions()
572572
mActionShowBookmarks->setStatusTip(tr("Show Bookmarks"));
573573
connect(mActionShowBookmarks, SIGNAL(triggered()), this, SLOT(showBookmarks()));
574574
//
575+
mActionShowAllToolbars = new QAction(tr("Show most toolbars"), this);
576+
mActionShowAllToolbars->setShortcut(tr("S", "Show most toolbars"));
577+
mActionShowAllToolbars->setStatusTip(tr("Show most toolbars"));
578+
connect(mActionShowAllToolbars, SIGNAL(triggered()), this,
579+
SLOT(showAllToolbars()));
580+
//
581+
mActionHideAllToolbars = new QAction(tr("Hide most toolbars"), this);
582+
mActionHideAllToolbars->setShortcut(tr("H", "Hide most toolbars"));
583+
mActionHideAllToolbars->setStatusTip(tr("Hide most toolbars"));
584+
connect(mActionHideAllToolbars, SIGNAL(triggered()), this,
585+
SLOT(hideAllToolbars()));
586+
//
575587
mActionNewBookmark= new QAction(QIcon(myIconPath+"/mActionNewBookmark.png"), tr("New Bookmark..."), this);
576588
mActionNewBookmark->setShortcut(tr("Ctrl+B","New Bookmark"));
577589
mActionNewBookmark->setStatusTip(tr("New Bookmark"));
@@ -700,6 +712,7 @@ void QgisApp::createActionGroups()
700712

701713
void QgisApp::createMenus()
702714
{
715+
QString myIconPath = QgsApplication::themePath();
703716
//
704717
// File Menu
705718
mFileMenu = menuBar()->addMenu(tr("&File"));
@@ -729,7 +742,14 @@ void QgisApp::createMenus()
729742
mViewMenu->addAction(mActionDraw);
730743
mViewMenu->addAction(mActionShowBookmarks);
731744
mViewMenu->addAction(mActionNewBookmark);
732-
745+
mToolbarMenu = mViewMenu->addMenu(QIcon(myIconPath+"/mActionOptions.png"),
746+
tr("&Toolbars..."));
747+
748+
//
749+
// View:toolbars menu
750+
mToolbarMenu->addAction(mActionShowAllToolbars);
751+
mToolbarMenu->addAction(mActionHideAllToolbars);
752+
733753
//
734754
// Layers Menu
735755
mLayerMenu = menuBar()->addMenu(tr("&Layer"));
@@ -5252,3 +5272,24 @@ void QgisApp::newBookmark()
52525272
}
52535273
}
52545274
}
5275+
5276+
void QgisApp::showAllToolbars()
5277+
{
5278+
setToolbarVisibility(true);
5279+
}
5280+
5281+
void QgisApp::hideAllToolbars()
5282+
{
5283+
setToolbarVisibility(false);
5284+
}
5285+
5286+
void QgisApp::setToolbarVisibility(bool visibility)
5287+
{
5288+
mFileToolBar->setVisible(visibility);
5289+
mLayerToolBar->setVisible(visibility);
5290+
mMapNavToolBar->setVisible(visibility);
5291+
mDigitizeToolBar->setVisible(visibility);
5292+
mAttributesToolBar->setVisible(visibility);
5293+
mPluginToolBar->setVisible(visibility);
5294+
mHelpToolBar->setVisible(visibility);
5295+
}

‎src/gui/qgisapp.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,12 @@ public slots:
282282
void showBookmarks();
283283
//! Create a new spatial bookmark
284284
void newBookmark();
285+
//! Lets the user show all of the toolbars
286+
void showAllToolbars();
287+
//! Lets the user hide all of the toolbars
288+
void hideAllToolbars();
289+
//! Sets the visibility of the toolbars
290+
void setToolbarVisibility(bool visibility);
285291
//! activates the capture point tool
286292
void capturePoint();
287293
//! activates the capture line tool
@@ -500,6 +506,8 @@ public slots:
500506
QAction *mActionAddWmsLayer;
501507
QAction *mActionInOverview;
502508
QAction *mActionDraw;
509+
QAction *mActionShowAllToolbars;
510+
QAction *mActionHideAllToolbars;
503511
//
504512
//tool groups -------------------------------------
505513
QActionGroup *mMapToolGroup;
@@ -508,6 +516,7 @@ public slots:
508516
QMenu *mFileMenu;
509517
QMenu *mRecentProjectsMenu;
510518
QMenu *mViewMenu;
519+
QMenu *mToolbarMenu;
511520
QMenu *mLayerMenu;
512521
QMenu *mSettingsMenu;
513522
QMenu *mHelpMenu;

0 commit comments

Comments
 (0)
Please sign in to comment.