I have a plugin with a function (triggered by a button) that selects a specific layer by name, then shows its attribute table. When I close the plugin and open it again, the attribute table pops up twice, and repeating this keeps adding another table popup.
What's wrong?
Code:
def showTable(self):
for lyrs in QgsMapLayerRegistry.instance().mapLayers().values():
if lyrs.name() == "TestFeatures":
lyrTest = lyrs
self.iface.showAttributeTable(lyrTest)
initGui()method ? In my case, the QDialog object is instantiated whenrun()(default behavior fromPlugin builder) callback is executed. Can you provide an example of a minimal workinginitGui()method following your advice ? (I know this answer is 7 years old but it feels like this thread is still relevant) – Beinje Jul 25 '22 at 13:18