From 98b679a57e2702c96929ed3653207f136660c4a5 Mon Sep 17 00:00:00 2001 From: Fintan O'Sullivan Date: Fri, 11 Dec 2020 14:28:38 +1300 Subject: [PATCH] Added more features to gui (including data layer dropdown) --- helloworld/helloworld.py | 7 +++++++ 1 file changed, 7 insertions(+) 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()