Skip to content
Permalink
Browse files
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/qgis@5938 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
g_j_m committed Oct 11, 2006
1 parent 44d6e07 commit 909af2ffc321ca8dc54ceb66263791ff72448edf
Showing with 51 additions and 1 deletion.
  1. +42 −1 src/gui/qgisapp.cpp
  2. +9 −0 src/gui/qgisapp.h
@@ -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"));
@@ -700,6 +712,7 @@ void QgisApp::createActionGroups()

void QgisApp::createMenus()
{
QString myIconPath = QgsApplication::themePath();
//
// File Menu
mFileMenu = menuBar()->addMenu(tr("&File"));
@@ -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"));
@@ -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);
}
@@ -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
@@ -500,6 +506,8 @@ public slots:
QAction *mActionAddWmsLayer;
QAction *mActionInOverview;
QAction *mActionDraw;
QAction *mActionShowAllToolbars;
QAction *mActionHideAllToolbars;
//
//tool groups -------------------------------------
QActionGroup *mMapToolGroup;
@@ -508,6 +516,7 @@ public slots:
QMenu *mFileMenu;
QMenu *mRecentProjectsMenu;
QMenu *mViewMenu;
QMenu *mToolbarMenu;
QMenu *mLayerMenu;
QMenu *mSettingsMenu;
QMenu *mHelpMenu;

0 comments on commit 909af2f

Please sign in to comment.