c++ - How to use the same QAction in two QMenus with different text? -


so have action want expose in multiple menus (one of main menus, , context menus). i'd menu item text differ menu menu (to make mnemonic unique, , more or less verbose necessary in each context).

in mfc (which have pleasure of migrating away @ moment) easy, each menu's items defined separately, , map same id, linked handler. in qt though, qaction encapsulates behaviour text/icon/etc. don't suppose there's straightforward support return different text dependent on it's being used.

my thought how handle is, each location, create "proxy" qaction, has text specific context , has triggered() signal connected original qaction's one. thought should check first whether there's easier way approach this.

i don't know mfc, in qt - qaction interface. 1 qaction object can have 1 text display. real action qaction does, implement in qt calls slot. can have interfaces(or qactions objects) pointing same slot - connect qaction objects, want same thing, same slot.

hope helps.


Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

visual c++ - Using relative values in array sorting ( asm ) -