Add new items in context menu when right-clicking on a selection
How can I add new items in the context menu when right-clicking on selected nodes in the Document View?
For example, after selecting a few nodes in the Document View, I do a right-click to open a context menu. There, I would like to add a function call "Do This For Me". How can I implement "Do This For Me" ?
Stephane last edited by Stephane
At the moment (0.7.0), the context menu is composed of three parts:
- actions provided by the active editor, if any
- actions provided by selected nodes, if any
- actions provided by SAMSON (e.g. visibility, etc.)
So the only way right now would be to develop a new editor and overload the function
getActions(SBVector<SBGAction*>& actionVector)to fill
actionVectorwith the editor actions. The user would have to select your editor before being able to see the context actions. Do you think we should have a mechanism to register more actions in the context menu?
@stephane-redon I think it can be nice for the developers to be able to register more actions in the context menu. But it can also make the context menu too crowded. Perhaps, you can make something in the Preferences so that the users can select to add which actions to show in the context menu.
Actually, I am developing an app to convert a list of conformations to a path and vice versa for my work.
So I was thinking it can be useful to add an action in the context menu so that after selecting a list of conformations in the Document View, I would right-click and choose "Convert to Path". Do you have any suggestion to do it for this case?