I want to operate the panel from the QGIS python plugin. Examined.
I referred to the following exchanges. https://gis.stackexchange.com/questions/317058/how-to-add-dockwidget-above-the-layer-panel-using-pyqgis
If you can switch the layer panel in the Python console It's easy to implement in a plugin, isn't it?
So start the Python console and run the following command
from PyQt4.QtGui import QDockWidget
#Get layer panel (return value is array)
layersPanel = [x for x in iface.mainWindow().findChildren(QDockWidget) if x.objectName() == 'Layers']
#I'll show you
layersPanel[0].setVisible(True)
#I'll erase it
layersPanel[0].setVisible(False)
did it.
How to find the name specified in objectName by displaying it in the above loop.
From the QGIS repository "qgisapp.cpp" to mLayerTreeDock-> setObjectName (" Layers ");
I think you'll find what you're adding to.
that's all
Recommended Posts