c++ - Pop up menu event control in Qt -
when add pop menu in qt follows:
qmenu menu(widget); menu.addaction("aaa"); menu.exec(eventpress->globalpos());
how control "aaa" action events. e.g. when "aaa" clicked.
you can overloaded addaction.
from qt assistant
convenience function creates new action text text , optional shortcut shortcut. action's triggered() signal connected receiver's member slot. function adds newly created action menu's list of actions , returns it.
myclass::popup() { qmenu menu(widget); menu.addaction("aaa", this, slot(burncase())); menu.exec(eventpress->globalpos()); } // slot myclass::burncase() { }
Comments
Post a Comment