PDA

View Full Version : how i can add checkboxes to contextMenus?



quickNitin
15th November 2006, 08:53
How i can make checkbox a part of menu item sothat menu will be like we have when we right click over designers toolbar.

quickNitin

jpn
15th November 2006, 08:55
You have to make the appropriate action checkable. See QAction::setCheckable().

quickNitin
15th November 2006, 09:39
thanks jacek,
i have some more doubt.
What i want to do is to make submenu checkable.
This submenu contains menu item responsible for displaying various shapes.
When this submenu is not checked all item displayed by submenu's menu item are not shown.
Also subMenu should not expand. how i can avoid submenu from expanding.

jpn
15th November 2006, 12:35
thanks jacek,
i have some more doubt.
What i want to do is to make submenu checkable.
This submenu contains menu item responsible for displaying various shapes.
When this submenu is not checked all item displayed by submenu's menu item are not shown.
Also subMenu should not expand. how i can avoid submenu from expanding.
Heh, jacek indeed deserves to be thanked for doing such a great job on the forums.. :)
Anyway.. a single action can be checkable, a submenu can't. And it wouldn't make any sense either. Consider an interface which requires user to click on the submenu item to expand it (this is the case for example with the motif style). What should be done upon click over the submenu? Change check state or show the menu? You can disable the submenu if you want to prevent it from to be shown.