[Paraview-developers] Changing context menu of a view from a plugin
Jérôme
jerome.velut at gmail.com
Thu Apr 21 03:21:38 EDT 2011
Hi,
I wrote a plugin that adds some item in the context menu when right
clicking in a view. With PV-3.8, I just had to :
view->GetWidget()->addAction( item )
Since PV-3.10, the context menu is implemented through
pqParaViewBehaviours, specifically pqPipelineContextMenuBehaviour. It
seems that the menu is now created at run-time, at each right-click
thanks to pqPipelineContextMenuBehaviour::eventFilter.
Thus I tried to derive pqPipelineContextMenuBehaviour into
pqModifiedContextMenu, overload eventFilter and call
view->installEventFilter( modfiedContextMenu). But the menu is cleaned
in the parent class, though I have to call the parent eventFilter !!
I also tried to integrally copy the parent eventFilter, but with no
luck : the event seems to not being recognize. I think I missed
something in the derivation or instantiation process.
One solution would be to overload
pqPipelineContextMenuBehaviour::buildMenu(), but it is called only
when a polydata repr is picked.
Note that if I keep the pv-3.8 fashion, my plugin works but awkwardly
: y context menu appears first, then I have to click once more to get
the ParaView standard context menu (link camera or representation
option)...
How can I change the context menu of a view from a plugin ?
Thanks a lot !
Jerome
More information about the Paraview-developers
mailing list