TransWikia.com

PyQt5: Wipe XYZ Connections

Geographic Information Systems Asked by HelpOverFlow on August 8, 2021

I am trying to remove all the xyz connections in a QGIS3 project via PyQt5. I am hitting the following error for the code bellow:

for group in getGroupXYZ(self): NameError: name 'getGroupXYZ' is not defined

 from qgis.PyQt.QtCore import QSettings
 
 s = QSettings()
 xyz = 'qgis/connections-xyz'

 def getGroupXYZ(self):
     s.beginGroup(xyz)
     groupsXYZ = s.childGroups()
     s.endGroup()
     return groupsXYZ

 def removeAllConnectionsXYZ(self):
     for group in getGroupXYZ():
     s.beginGroup(xyz)
     s.remove("")
     s.endGroup()

 self.dlg.wipeAllConnectionsXyz.clicked.connect(
     self.removeAllConnectionsXYZ)

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP