Skip to content

Commit

Permalink
Overloaded addDockWidget() so that when plugins (or any other code) a…
Browse files Browse the repository at this point in the history
…dds a dock widget, an entry for it is automatically added to the view menu

git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@9022 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
timlinux committed Aug 7, 2008
1 parent 12b058b commit 54c6723
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
21 changes: 12 additions & 9 deletions src/app/qgisapp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -323,13 +323,6 @@ static void customSrsValidation_(QgsSpatialRefSys* srs)
mSplash->showMessage(tr("Setting up the GUI"), Qt::AlignHCenter | Qt::AlignBottom);
qApp->processEvents();

// Make the right and left docks consume all vertical space and top
// and bottom docks nest between them

setCorner(Qt::TopLeftCorner, Qt::LeftDockWidgetArea);
setCorner(Qt::BottomLeftCorner, Qt::LeftDockWidgetArea);
setCorner(Qt::TopRightCorner, Qt::RightDockWidgetArea);
setCorner(Qt::BottomRightCorner, Qt::RightDockWidgetArea);


createActions();
Expand Down Expand Up @@ -1397,7 +1390,6 @@ void QgisApp::createOverview()
mOverviewDock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
mOverviewDock->setWidget(overviewCanvas);
addDockWidget(Qt::LeftDockWidgetArea, mOverviewDock);
mViewMenu->addAction(mOverviewDock->toggleViewAction());

mMapCanvas->setOverview(overviewCanvas);

Expand All @@ -1411,6 +1403,18 @@ void QgisApp::createOverview()
mMapCanvas->setWheelAction((QgsMapCanvas::WheelAction) action, zoomFactor);
}

void QgisApp::addDockWidget ( Qt::DockWidgetArea theArea, QDockWidget * thepDockWidget )
{
QMainWindow::addDockWidget ( theArea, thepDockWidget );
// Make the right and left docks consume all vertical space and top
// and bottom docks nest between them
setCorner(Qt::TopLeftCorner, Qt::LeftDockWidgetArea);
setCorner(Qt::BottomLeftCorner, Qt::LeftDockWidgetArea);
setCorner(Qt::TopRightCorner, Qt::RightDockWidgetArea);
setCorner(Qt::BottomRightCorner, Qt::RightDockWidgetArea);
// add to the view menu
mViewMenu->addAction(thepDockWidget->toggleViewAction());
}

void QgisApp::createLegend()
{
Expand All @@ -1432,7 +1436,6 @@ void QgisApp::createLegend()
// mLegendDock->setFeatures(mLegendDock->features() & ~QDockWidget::DockWidgetClosable);
mLegendDock->setWidget(mMapLegend);
addDockWidget(Qt::LeftDockWidgetArea, mLegendDock);
mViewMenu->addAction(mLegendDock->toggleViewAction());
return;
}

Expand Down
4 changes: 4 additions & 0 deletions src/app/qgisapp.h
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,10 @@ public slots:


public slots:
/** Add a dock widget to the main window. Overloaded from QMainWindow.
* After adding the dock widget to the ui (by delegating to the QMainWindow
* parent class, it will also add it to the view menu list of docks.*/
void addDockWidget ( Qt::DockWidgetArea area, QDockWidget * dockwidget );
void showProgress(int theProgress, int theTotalSteps);
void extentsViewToggled(bool theFlag);
void showExtents();
Expand Down

0 comments on commit 54c6723

Please sign in to comment.