Estoy intentando crear un botón que cambie la visibilidad de las capas agrupadas. Cuando el usuario hace clic en el botón, todas las capas dentro del grupo se ocultan cuando se vuelve a hacer clic en todas las capas.
Hasta ahora sé cómo ocultar capas y configurarlas en dos botones separados. Pero no puedo agregar a la función dentro de un botón.
#connect to Hide_int button that hide intensity rasters
self.dockwidget.Hide_int.clicked.connect(self.hideint)
#connect to Hide_img button that hide img rasters
self.dockwidget.Hide_img.clicked.connect(self.hideimg)
def hideint(self):
self.maps_treeview = QTreeView()
QgsProject.instance().layerTreeRoot().findGroup('Int').setVisible(0)
print "Connected"
pass
def hideimg(self):
QgsProject.instance().layerTreeRoot().findGroup('Int').setVisible(2)
QgsProject.instance().layerTreeRoot().findGroup('Int').updateChildVisibility()
print "Connected"
pass
Estoy usando Qgis 2.16. ¿Me puedes ayudar?