[QGIS Commit] r9022 - trunk/qgis/src/app
svn_qgis at osgeo.org
svn_qgis at osgeo.org
Thu Aug 7 17:38:37 EDT 2008
Author: timlinux
Date: 2008-08-07 17:38:37 -0400 (Thu, 07 Aug 2008)
New Revision: 9022
Modified:
trunk/qgis/src/app/qgisapp.cpp
trunk/qgis/src/app/qgisapp.h
Log:
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
Modified: trunk/qgis/src/app/qgisapp.cpp
===================================================================
--- trunk/qgis/src/app/qgisapp.cpp 2008-08-07 13:33:02 UTC (rev 9021)
+++ trunk/qgis/src/app/qgisapp.cpp 2008-08-07 21:38:37 UTC (rev 9022)
@@ -323,15 +323,8 @@
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();
createActionGroups();
createMenus();
@@ -1397,7 +1390,6 @@
mOverviewDock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
mOverviewDock->setWidget(overviewCanvas);
addDockWidget(Qt::LeftDockWidgetArea, mOverviewDock);
- mViewMenu->addAction(mOverviewDock->toggleViewAction());
mMapCanvas->setOverview(overviewCanvas);
@@ -1411,6 +1403,18 @@
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 @@
// mLegendDock->setFeatures(mLegendDock->features() & ~QDockWidget::DockWidgetClosable);
mLegendDock->setWidget(mMapLegend);
addDockWidget(Qt::LeftDockWidgetArea, mLegendDock);
- mViewMenu->addAction(mLegendDock->toggleViewAction());
return;
}
Modified: trunk/qgis/src/app/qgisapp.h
===================================================================
--- trunk/qgis/src/app/qgisapp.h 2008-08-07 13:33:02 UTC (rev 9021)
+++ trunk/qgis/src/app/qgisapp.h 2008-08-07 21:38:37 UTC (rev 9022)
@@ -332,6 +332,10 @@
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();
More information about the QGIS-commit
mailing list