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

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -