PDA

View Full Version : I Can't enable DefaultContextMenu with ContextMenuEvent for my custom widget



Naveen
17th February 2006, 12:26
I have a custom widget class which just draws a Rectangle of MaximumWidth and length of 30 pixels .Iwant to make it a DefaultcontextMenu.. and also I'm not able to implement the contextMenuEvent for this

I'm very new to this could anyone send me a snippet code for this


Thanks in Advance
Naveen

yogeshm02
17th February 2006, 13:40
Which version of qt are you using.
Can you show the code here. There is nothing stopping you from re-implementing contextMenuEvent.

wysota
17th February 2006, 13:48
I have a custom widget class which just draws a Rectangle of MaximumWidth and length of 30 pixels .Iwant to make it a DefaultcontextMenu.. and also I'm not able to implement the contextMenuEvent for this

For default context menu the contextMenuEvent is not checked. Default context menu makes use of actions added to a widget (with addAction()). If you want to use contextMenuEvent, you have to switch context menu type to custom.

yogeshm02
17th February 2006, 13:53
.. and also I'm not able to implement the contextMenuEvent for this


I thought this implies that he is unable to compile the code.

wysota
17th February 2006, 14:28
Sorry, looks like I was wrong here. Default context menu policy is to use contextMenuEvent and not a list of QActions.

So, based on that... can we see the code of contextMenuEvent? :)