如何在QGIS 2.6中通过Python更改图例中的组图标

时间:2015-02-15 10:38:47

标签: python icons legend qgis

我希望插件创建的组与man创建的组不同。 ;) 如何在QGIS 2.6中通过Python更改图例中的组图标?在版本1.x我这样做:

self.legendTree = self.iface.mainWindow().findChild(QDockWidget,"Legend").findChild(QTreeWidget)
currGrp=self.legendTree.currentItem()
currGrp.setIcon(0,self.setMyIcon("folder.png")

在pyqgis 2.6中,我以这种方式创建组

root = QgsProject.instance().layerTreeRoot()
node_group1 = root.insertGroup(0, "Group 1")

但是如何更改图标?

0 个答案:

没有答案