I wrote a project macro which, when loaded, hides all toolbars except for one which contains a couple of my plugin buttons. I know it's possible to trigger core buttons like the following example:
self.iface.actionPanToSelected().trigger()
But is it possible to do this for a custom-made plugin?
I noticed I could identify the objects of the toolbar using:
from PyQt4.QtGui import QToolBar
for x in iface.mainWindow().findChildren(QToolBar):
# x.objectName() returns the names of the toolbars
if x.objectName() == 'Example':
print x.children()
[<PyQt4.QtGui.QLayout object at 0x0000000023589840>, <PyQt4.QtGui.QToolButton object at 0x0000000024DCE488>, <PyQt4.QtGui.QAction object at 0x0000000024DCE510>,
<PyQt4.QtGui.QToolButton object at 0x0000000024DCE598>, <PyQt4.QtGui.QToolButton object at 0x0000000024DCE620>]
But unsure how to trigger the buttons...