+1
On May 7, 2008, at 11:09 AM, Tom Elwertowski wrote:
> Hi Agus,
>
> This is something I've recently been experimenting with.
>
> Attached is a patch which modifies the legend and overview panes to
> be QDockWidgets. They can be undocked or docked left or right; there
> is also an entry on the View menu if they get lost.
>
> This patch does not correctly resize the map content when
> (un)docking occurs. I will fix these details next if others like
> this proposal.
>
> Tom
>
>
> Agustin Lobo wrote:
>> I'd like to propose the idea of being able to undock the
>> legend panel and getting it as an independent window, which
>> could be even sent to another Desk. In this way the area for the
>> geographic display could be enlarged. Also, in general, we should
>> consider that many (most?) users will have 2 monitors and I've
>> personally found handy having one of them just devoted to the
>> geographic
>> display.
>> Also, It would be useful if the grass tools window could be
>> sent to a different Desk. Currently, if you send the
>> grass tools window to another Desk, everything goes to that desk.
>> Agus
>
> Index: src/app/qgisapp.h
> ===================================================================
> --- src/app/qgisapp.h (revision 8410)
> +++ src/app/qgisapp.h (working copy)
> @@ -35,6 +35,7 @@
> class QPixmap;
> class QSplashScreen;
> class QValidator;
> +class QActionGroup;
>
> class QgisAppInterface;
> class QgsClipboard;
> @@ -52,7 +53,6 @@
> class QgsRect;
> class QgsVectorLayer;
>
> -#include <ui_qgisappbase.h>
> #include <QMainWindow>
> #include <QAbstractSocket>
>
> @@ -62,7 +62,7 @@
> /*! \class QgisApp
> * \brief Main window for the Qgis application
> */
> -class QgisApp : public QMainWindow, public Ui::QgisAppBase
> +class QgisApp : public QMainWindow
> {
> Q_OBJECT;
> public:
> @@ -535,7 +535,10 @@
> QMenu *mSettingsMenu;
> QMenu *mHelpMenu;
>
> - class Tools
> + QDockWidget *mLegendDock;
> + QDockWidget *mOverviewDock;
> +
> +class Tools
> {
> public:
> QgsMapTool* mZoomIn;
> Index: src/app/qgisapp.cpp
> ===================================================================
> --- src/app/qgisapp.cpp (revision 8410)
> +++ src/app/qgisapp.cpp (working copy)
> @@ -33,6 +33,7 @@
> #include <QDesktopWidget>
> #include <QDialog>
> #include <QDir>
> +#include <QDockWidget>
> #include <QEvent>
> #include <QFile>
> #include <QFileInfo>
> @@ -305,7 +306,8 @@
> : QMainWindow(parent,fl),
> mSplash(splash)
> {
> - setupUi(this);
> +// setupUi(this);
> + resize(640, 480);
>
> mSplash->showMessage(tr("Checking database"), Qt::AlignHCenter |
> Qt::AlignBottom);
> qApp->processEvents();
> @@ -327,8 +329,8 @@
> setTheme(mThemeName);
> updateRecentProjectPaths();
> createCanvas();
> + createLegend();
> createOverview();
> - createLegend();
> createMapTips();
>
> mComposer = new QgsComposer(this); // Map composer
> @@ -378,7 +380,7 @@
>
> // now build raster file filter
> QgsRasterLayer::buildSupportedRasterFileFilter( mRasterFileFilter );
> -
> +/*
> // Set the background colour for toolbox and overview as they
> default to
> // white instead of the window color
> QPalette myPalette = toolBox->palette();
> @@ -389,7 +391,7 @@
> myPalette.setColor(QPalette::Button, myPalette.window().color());
> mMapLegend->setPalette(myPalette);
> //and for overview control this is done in createOverView method
> -
> +*/
> // Do this last in the ctor to ensure that all members are
> instantiated properly
> setupConnections();
> //
> @@ -493,12 +495,12 @@
>
> // Add the recently accessed project file paths to the File menu
> mRecentProjectPaths = settings.readListEntry("/UI/
> recentProjectsList");
> -
> +/*
> // Set the behaviour when the map splitters are resized
> bool splitterRedraw = settings.value("/qgis/splitterRedraw",
> true).toBool();
> canvasLegendSplit->setOpaqueResize(splitterRedraw);
> legendOverviewSplit->setOpaqueResize(splitterRedraw);
> -}
> +*/}
>
>
> //////////////////////////////////////////////////////////////////////
> @@ -1314,10 +1316,11 @@
> mMapCanvas = new QgsMapCanvas(this, "theMapCanvas" );
> mMapCanvas->setWhatsThis(tr("Map canvas. This is where raster and
> vector layers are displayed when added to the map"));
>
> - mMapCanvas->setMinimumWidth(10);
> - QVBoxLayout *myCanvasLayout = new QVBoxLayout;
> - myCanvasLayout->addWidget(mMapCanvas);
> - tabWidget->widget(0)->setLayout(myCanvasLayout);
> +// mMapCanvas->setMinimumWidth(10);
> +// QVBoxLayout *myCanvasLayout = new QVBoxLayout;
> +// myCanvasLayout->addWidget(mMapCanvas);
> +// tabWidget->widget(0)->setLayout(myCanvasLayout);
> + setCentralWidget(mMapCanvas);
> // set the focus to the map canvas
> mMapCanvas->setFocus();
>
> @@ -1367,10 +1370,16 @@
> QBitmap overviewPanBmpMask = QBitmap::fromData(QSize(16, 16),
> pan_mask_bits);
> mOverviewMapCursor = new QCursor(overviewPanBmp,
> overviewPanBmpMask, 5, 5);
> overviewCanvas->setCursor(*mOverviewMapCursor);
> - QVBoxLayout *myOverviewLayout = new QVBoxLayout;
> - myOverviewLayout->addWidget(overviewCanvas);
> - overviewFrame->setLayout(myOverviewLayout);
> -
> +// QVBoxLayout *myOverviewLayout = new QVBoxLayout;
> +// myOverviewLayout->addWidget(overviewCanvas);
> +// overviewFrame->setLayout(myOverviewLayout);
> + mOverviewDock = new QDockWidget(tr("Overview"), this);
> + mOverviewDock->setObjectName("Overview");
> + mOverviewDock->setAllowedAreas(Qt::LeftDockWidgetArea |
> Qt::RightDockWidgetArea);
> + mOverviewDock->setWidget(overviewCanvas);
> + addDockWidget(Qt::LeftDockWidgetArea, mOverviewDock);
> + mViewMenu->addAction(mOverviewDock->toggleViewAction());
> +
> mMapCanvas->setOverview(overviewCanvas);
>
> // moved here to set anti aliasing to both map canvas and overview
> @@ -1395,9 +1404,16 @@
> mMapLegend->setToggleEditingAction(mActionToggleEditing);
>
> mMapLegend->setWhatsThis(tr("Map legend that displays all the
> layers currently on the map canvas. Click on the check box to turn a
> layer on or off. Double click on a layer in the legend to customize
> its appearance and set other properties."));
> - QVBoxLayout *myLegendLayout = new QVBoxLayout;
> - myLegendLayout->addWidget(mMapLegend);
> - toolBox->widget(0)->setLayout(myLegendLayout);
> +// QVBoxLayout *myLegendLayout = new QVBoxLayout;
> +// myLegendLayout->addWidget(mMapLegend);
> +// toolBox->widget(0)->setLayout(myLegendLayout);
> + mLegendDock = new QDockWidget(tr("Legend"), this);
> + mLegendDock->setObjectName("Legend");
> + mLegendDock->setAllowedAreas(Qt::LeftDockWidgetArea |
> Qt::RightDockWidgetArea);
> +// mLegendDock->setFeatures(mLegendDock->features() &
> ~QDockWidget::DockWidgetClosable);
> + mLegendDock->setWidget(mMapLegend);
> + addDockWidget(Qt::LeftDockWidgetArea, mLegendDock);
> + mViewMenu->addAction(mLegendDock->toggleViewAction());
> return;
> }
>
> @@ -1503,8 +1519,8 @@
>
> // store window geometry
> settings.setValue("/UI/geometry", saveGeometry());
> - settings.setValue("/UI/canvasSplitterState", canvasLegendSplit-
> >saveState());
> - settings.setValue("/UI/legendSplitterState", legendOverviewSplit-
> >saveState());
> +// settings.setValue("/UI/canvasSplitterState", canvasLegendSplit-
> >saveState());
> +// settings.setValue("/UI/legendSplitterState",
> legendOverviewSplit->saveState());
> }
>
> void QgisApp::restoreWindowState()
> @@ -1516,8 +1532,8 @@
>
> // restore window geometry
> restoreGeometry(settings.value("/UI/geometry").toByteArray());
> - canvasLegendSplit->restoreState(settings.value("/UI/
> canvasSplitterState").toByteArray());
> - legendOverviewSplit->restoreState(settings.value("/UI/
> legendSplitterState").toByteArray());
> +// canvasLegendSplit->restoreState(settings.value("/UI/
> canvasSplitterState").toByteArray());
> +// legendOverviewSplit->restoreState(settings.value("/UI/
> legendSplitterState").toByteArray());
> }
> ///////////// END OF GUI SETUP ROUTINES ///////////////
>
> @@ -4264,9 +4280,9 @@
> double zoomFactor = mySettings.value("/qgis/zoom_factor",
> 2).toDouble();
> mMapCanvas->setWheelAction((QgsMapCanvas::WheelAction) action,
> zoomFactor);
>
> - bool splitterRedraw = mySettings.value("/qgis/splitterRedraw",
> true).toBool();
> - canvasLegendSplit->setOpaqueResize(splitterRedraw);
> - legendOverviewSplit->setOpaqueResize(splitterRedraw);
> +// bool splitterRedraw = mySettings.value("/qgis/
> splitterRedraw", true).toBool();
> +// canvasLegendSplit->setOpaqueResize(splitterRedraw);
> +// legendOverviewSplit->setOpaqueResize(splitterRedraw);
> }
> }
>
> Index: src/app/qgisappinterface.cpp
> ===================================================================
> --- src/app/qgisappinterface.cpp (revision 8410)
> +++ src/app/qgisappinterface.cpp (working copy)
> @@ -133,7 +133,7 @@
>
> QToolBox* QgisAppInterface::getToolBox()
> {
> - return qgis->toolBox;
> + return NULL;
> }
>
> void QgisAppInterface::refreshLegend(QgsMapLayer *l)
> _______________________________________________
> Qgis-user mailing list
> [email protected]
> http://lists.qgis.org/cgi-bin/mailman/listinfo/qgis-user
-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
Gary Sherman
Chair, QGIS Project Steering Committee
-Micro Resources: http://mrcc.com
*Geospatial Hosting
*Web Site Hosting
-Desktop GIS Book:
*http://desktopgisbook.com
"We work virtually everywhere"
-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
_______________________________________________
Qgis-user mailing list
[email protected]
http://lists.qgis.org/cgi-bin/mailman/listinfo/qgis-user