Skip to content

Commit 54c6723

Browse files
author
timlinux
committedAug 7, 2008
Overloaded addDockWidget() so that when plugins (or any other code) adds 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

File tree

2 files changed

+16
-9
lines changed

2 files changed

+16
-9
lines changed
 

‎src/app/qgisapp.cpp

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -323,13 +323,6 @@ static void customSrsValidation_(QgsSpatialRefSys* srs)
323323
mSplash->showMessage(tr("Setting up the GUI"), Qt::AlignHCenter | Qt::AlignBottom);
324324
qApp->processEvents();
325325

326-
// Make the right and left docks consume all vertical space and top
327-
// and bottom docks nest between them
328-
329-
setCorner(Qt::TopLeftCorner, Qt::LeftDockWidgetArea);
330-
setCorner(Qt::BottomLeftCorner, Qt::LeftDockWidgetArea);
331-
setCorner(Qt::TopRightCorner, Qt::RightDockWidgetArea);
332-
setCorner(Qt::BottomRightCorner, Qt::RightDockWidgetArea);
333326

334327

335328
createActions();
@@ -1397,7 +1390,6 @@ void QgisApp::createOverview()
13971390
mOverviewDock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
13981391
mOverviewDock->setWidget(overviewCanvas);
13991392
addDockWidget(Qt::LeftDockWidgetArea, mOverviewDock);
1400-
mViewMenu->addAction(mOverviewDock->toggleViewAction());
14011393

14021394
mMapCanvas->setOverview(overviewCanvas);
14031395

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

1406+
void QgisApp::addDockWidget ( Qt::DockWidgetArea theArea, QDockWidget * thepDockWidget )
1407+
{
1408+
QMainWindow::addDockWidget ( theArea, thepDockWidget );
1409+
// Make the right and left docks consume all vertical space and top
1410+
// and bottom docks nest between them
1411+
setCorner(Qt::TopLeftCorner, Qt::LeftDockWidgetArea);
1412+
setCorner(Qt::BottomLeftCorner, Qt::LeftDockWidgetArea);
1413+
setCorner(Qt::TopRightCorner, Qt::RightDockWidgetArea);
1414+
setCorner(Qt::BottomRightCorner, Qt::RightDockWidgetArea);
1415+
// add to the view menu
1416+
mViewMenu->addAction(thepDockWidget->toggleViewAction());
1417+
}
14141418

14151419
void QgisApp::createLegend()
14161420
{
@@ -1432,7 +1436,6 @@ void QgisApp::createLegend()
14321436
// mLegendDock->setFeatures(mLegendDock->features() & ~QDockWidget::DockWidgetClosable);
14331437
mLegendDock->setWidget(mMapLegend);
14341438
addDockWidget(Qt::LeftDockWidgetArea, mLegendDock);
1435-
mViewMenu->addAction(mLegendDock->toggleViewAction());
14361439
return;
14371440
}
14381441

‎src/app/qgisapp.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,10 @@ public slots:
332332

333333

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

0 commit comments

Comments
 (0)
Please sign in to comment.