diff --git a/helloworld/helloworld.py b/helloworld/helloworld.py index e64eedc..f5fd962 100644 --- a/helloworld/helloworld.py +++ b/helloworld/helloworld.py @@ -188,6 +188,13 @@ def run(self): if self.first_start == True: self.first_start = False self.dlg = helloWorldDialog() + + # Fetch the currently loaded layers + layers = QgsProject.instance().layerTreeRoot().children() + # Clear the contents of the comboBox from previous runs + self.dlg.comboBox.clear() + # Populate the comboBox with names of all the loaded layers + self.dlg.comboBox.addItems([layer.name() for layer in layers]) # show the dialog self.dlg.show()