[QGIS-Developer] Get current QDockWidget in specific location

Germán Carrillo carrillo.german at gmail.com
Thu Jun 13 19:25:47 PDT 2024


Hi Luke,


you can get a list of all QDockWidget objects in this way:

iface.mainWindow().findChildren(QDockWidget)

>From there you could get objectNames, whether the dock widget is visible or
not, its allowed areas and window title, among other properties.

The objectName is relevant, because you can pass it as the 3rd parameter to
addTabifiedDockWidget(), in this way:

iface.addTabifiedDockWidget(Qt.RightDockWidgetArea, my_own_dock_widget,
["ProcessingToolbox"])

In that way, your dock widget will be tabified taking the ProcessingToolbox
dock widget as a reference. If you want your dock widget on top, pass an
extra parameter raiseTab as True.

I hope this helps.


Regards,

Germán

El mié, 12 jun 2024 a las 20:22, Catania, Luke A ERDC-RDE-GRL-VA CIV via
QGIS-Developer (<qgis-developer at lists.osgeo.org>) escribió:

> How can I get the reference to a QDockWidget that is already docked.  I
> want to call tabifyDockWidget so I can add a new QDockWidget to the same
> location.  The first is already in place from exsiting code and I know I
> can probably create a getter method on the code that adds the first doc
> widget but I was hoping not add anything to that code and use some existing
> built in method that would allow be to specify a dock widget location and
> return a reference to what is currently docked at that location.
>
>
>
> Thanks,
>
> Luke
> _______________________________________________
> QGIS-Developer mailing list
> QGIS-Developer at lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
>


-- 
-----------
   |\__
(:>__)(
   |/
Soluciones Geoinformáticas Libres
http://geotux.tuxfamily.org/
https://twitter.com/GeoTux2
<http://twitter.com/GeoTux2>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20240613/13a92762/attachment.htm>


More information about the QGIS-Developer mailing list