Design-Question: How to add context-menu actions as a Plugin - how to as a containing App

Milian Wolff mail at milianw.de
Mon Feb 8 13:56:41 UTC 2010


Hey fellow hackers!

In KDevelop we have a problem:

So far we clear the context menu in one of our slots that's connected to the 
contextMenuAboutToShow(KTextEditor::View*,QMenu*) signal of a KTextEditor 
view.

We need this, since we currently want to add new Actions depending on the 
cursor position/word under cursor. Meaning: The Menu is not static, and 
Andreas doesn't want me to clutter our code with constant action pointers or 
checking via object names whether some action was already added.

This lead us to the question: Why is the menu not "cleaned" for each 
contextMenuAboutToShow emit? I'm with Apaku here: Creating a new action is not 
an expensive operation and cluttering the code needlessly just for caching 
static actions is imo not so nice.

Can we change that (Simply pass defaultContextMenu() to the emit)?

The problem I see with the current API is probably the 
"setContextMenu(QMenu*)" method in KTextEditor::View... I don't know how that 
should be handled... Or is this maybe something we should use in KDevelop 
instead of the Slots?

Any ideas?
-- 
Milian Wolff
mail at milianw.de
http://milianw.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20100208/4b9c6fe7/attachment.sig>


More information about the KDevelop-devel mailing list