[Qgis-developer] How to add a QDockWidget?

Markus Havemann m.havemann at gmx.de
Thu Jul 3 10:42:34 EDT 2008


Hi Tim

thanks for your answer.

I have partitially solved the problem by using this code, which works well for me:

QDockWidget *dock = new QDockWidget(tr("Hallo"), 0);
dock->setWidget(myGroupBox);
dock->setObjectName("Hallo");
dock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
qobject_cast<QgisApp *>(mQGisIface->getMainWindow())->addDockWidget(Qt::LeftDockWidgetArea, dock);

But I think this is clearly against the intention of the interface class to shield QgisApp from plugin calls, as I understand the getMainWindow() member should only be used when connecting to QMainWindow signals.

So it's not soooo urgent now, but it should certainly be done before 1.0 release.

Ciao
Markus



Hi Markus

Firstly my apologies for the breakage of your toolbox related code -
we are busy cleaning up the UI for the 1.0 release and unfortunately
the toolbox was dropped. I'm going to change the plugin interface to
expose the addDockWidget call - can you please file a bug and I will
do this (unfortunately it will be ost 0.11.0 release since we are in
feature freeze. If this feature is really important to you and since
its scope is quite small we can put in a request for a last minute
change before 0.11.0 goes out to accommodate your needs.

Regards

Tim

2008/7/3 Markus Havemann <m.havemann at gmx.de>:
> > Hello
> >
> > somewhere between v0.10.0 and now the Legend and Overview Box was
> > changed from QToolBox to QDockWidgets.
> >
> > Before it was possible to add my own ToolBoxItems by calling
> > QgisAppInterface::getToolBox() and then adding the items.
> >
> > Now it should work by preparing QDockWidgets and then calling the
> > QgsApp member inherited from QMainWindow addDockWidget(
> > Qt::DockWidgetArea area, QDockWidget * dockwidget ). But I can't find
> > any Interface member to enable me to do this from a plugin?
> >
> > Any suggestion, how to do this?
> >
> > Ciao
> > Markus
-- 
Psssst! Schon das coole Video vom GMX MultiMessenger gesehen?
Der Eine für Alle: http://www.gmx.net/de/go/messenger03


More information about the Qgis-developer mailing list