Skip to content

Commit

Permalink
Provide menu options to view and hide the toolbars. This provides a
Browse files Browse the repository at this point in the history
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
  • Loading branch information
g_j_m committed Oct 11, 2006
1 parent a62d1bf commit adb5b48
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 1 deletion.
43 changes: 42 additions & 1 deletion src/gui/qgisapp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -572,6 +572,18 @@ void QgisApp::createActions()
mActionShowBookmarks->setStatusTip(tr("Show Bookmarks"));
connect(mActionShowBookmarks, SIGNAL(triggered()), this, SLOT(showBookmarks()));
//
mActionShowAllToolbars = new QAction(tr("Show most toolbars"), this);
mActionShowAllToolbars->setShortcut(tr("S", "Show most toolbars"));
mActionShowAllToolbars->setStatusTip(tr("Show most toolbars"));
connect(mActionShowAllToolbars, SIGNAL(triggered()), this,
SLOT(showAllToolbars()));
//
mActionHideAllToolbars = new QAction(tr("Hide most toolbars"), this);
mActionHideAllToolbars->setShortcut(tr("H", "Hide most toolbars"));
mActionHideAllToolbars->setStatusTip(tr("Hide most toolbars"));
connect(mActionHideAllToolbars, SIGNAL(triggered()), this,
SLOT(hideAllToolbars()));
//
mActionNewBookmark= new QAction(QIcon(myIconPath+"/mActionNewBookmark.png"), tr("New Bookmark..."), this);
mActionNewBookmark->setShortcut(tr("Ctrl+B","New Bookmark"));
mActionNewBookmark->setStatusTip(tr("New Bookmark"));
Expand Down Expand Up @@ -700,6 +712,7 @@ void QgisApp::createActionGroups()

void QgisApp::createMenus()
{
QString myIconPath = QgsApplication::themePath();
//
// File Menu
mFileMenu = menuBar()->addMenu(tr("&File"));
Expand Down Expand Up @@ -729,7 +742,14 @@ void QgisApp::createMenus()
mViewMenu->addAction(mActionDraw);
mViewMenu->addAction(mActionShowBookmarks);
mViewMenu->addAction(mActionNewBookmark);

mToolbarMenu = mViewMenu->addMenu(QIcon(myIconPath+"/mActionOptions.png"),
tr("&Toolbars..."));

//
// View:toolbars menu
mToolbarMenu->addAction(mActionShowAllToolbars);
mToolbarMenu->addAction(mActionHideAllToolbars);

//
// Layers Menu
mLayerMenu = menuBar()->addMenu(tr("&Layer"));
Expand Down Expand Up @@ -5252,3 +5272,24 @@ void QgisApp::newBookmark()
}
}
}

void QgisApp::showAllToolbars()
{
setToolbarVisibility(true);
}

void QgisApp::hideAllToolbars()
{
setToolbarVisibility(false);
}

void QgisApp::setToolbarVisibility(bool visibility)
{
mFileToolBar->setVisible(visibility);
mLayerToolBar->setVisible(visibility);
mMapNavToolBar->setVisible(visibility);
mDigitizeToolBar->setVisible(visibility);
mAttributesToolBar->setVisible(visibility);
mPluginToolBar->setVisible(visibility);
mHelpToolBar->setVisible(visibility);
}
9 changes: 9 additions & 0 deletions src/gui/qgisapp.h
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,12 @@ public slots:
void showBookmarks();
//! Create a new spatial bookmark
void newBookmark();
//! Lets the user show all of the toolbars
void showAllToolbars();
//! Lets the user hide all of the toolbars
void hideAllToolbars();
//! Sets the visibility of the toolbars
void setToolbarVisibility(bool visibility);
//! activates the capture point tool
void capturePoint();
//! activates the capture line tool
Expand Down Expand Up @@ -500,6 +506,8 @@ public slots:
QAction *mActionAddWmsLayer;
QAction *mActionInOverview;
QAction *mActionDraw;
QAction *mActionShowAllToolbars;
QAction *mActionHideAllToolbars;
//
//tool groups -------------------------------------
QActionGroup *mMapToolGroup;
Expand All @@ -508,6 +516,7 @@ public slots:
QMenu *mFileMenu;
QMenu *mRecentProjectsMenu;
QMenu *mViewMenu;
QMenu *mToolbarMenu;
QMenu *mLayerMenu;
QMenu *mSettingsMenu;
QMenu *mHelpMenu;
Expand Down

0 comments on commit adb5b48

Please sign in to comment.