Reputation: 1629
Im developing an application that uses voice to simulate some actions: drag and drop, select item, click buttons,etc. Now i have a menu that i need to simulate is clicked or triggered.
for linktype in globals.linkTypes.keys():
menu.addAction(linktype)
menu.connect(menu, QtCore.SIGNAL("triggered(QAction *)"), self.__setLinkType)
menu.exec_(QtGui.QCursor.pos())
When i say the name of one linktype in the menu i need that it generates the triggered signal. HOw can i emit it?
Thanks in advance!
Upvotes: 1
Views: 1408
Reputation: 22346
QMenu::addAction(const QString&)
returns the created QAction
, just call trigger()
on it.
action = menu.addAction(linktype)
...
action.trigger();
Upvotes: 2