[Qgis-developer] How to add a QDockWidget?

Tim Sutton tim at linfiniti.com
Mon Jul 14 16:22:46 EDT 2008


Hi Markus

I've committed a fix for this in r8774 (svn trunk). The change will be
part of 1.0.0 release only. Please let me know if you have any issues
and thanks for reporting this.

Regards

Tim

2008/7/3 Markus Havemann <m.havemann at gmx.de>:
> 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
> _______________________________________________
> Qgis-developer mailing list
> Qgis-developer at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-developer
>



-- 
Tim Sutton
QGIS Project Steering Committee Member - Release Manager
Visit http://qgis.org for a great open source GIS
openModeller Desktop Developer
Visit http://openModeller.sf.net for a great open source ecological
niche modelling tool
Home Page: http://tim.linfiniti.com
Skype: timlinux
Irc: timlinux on #qgis at freenode.net


More information about the Qgis-developer mailing list