I have a problem related to this question and the script. I can add some functionalities to Attribute Table (AT) by the script in the post. But according to the post, I have to open the AT using
showAttributeTable method, because the method returns the reference of the AT created/opened. Of course, I can get all references of the ATs opened, using the following line.
tables = [t for t in qApp.allWidgets() if t.objectName() == 'AttributeTable']
Let's say, I want to add a button to all AT to be opened later. Somehow, I think I need to catch "the AT's opening event" or "a widget/child was added to the
iface.mainWindow()" etc. I have looked at Qt documentation, but I couldn't find anything or I missed.
Briefly, I need to the reference of any AT while/before it is opening.