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

git-svn-id: http://svn.osgeo.org/qgis/trunk@9022 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
timlinux committed Aug 7, 2008
1 parent ef023cb commit dabe1969c0fb97fc74137616c2f0d3a2bb708b46
Showing with 16 additions and 9 deletions.
  1. +12 −9 src/app/qgisapp.cpp
  2. +4 −0 src/app/qgisapp.h
@@ -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();
@@ -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);

@@ -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()
{
@@ -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;
}

@@ -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();

0 comments on commit dabe196

Please sign in to comment.