Is menu a member variable of your class ??
I guess u have not declared it![]()
Is menu a member variable of your class ??
I guess u have not declared it![]()
Hi,
I have done something similar in python, I would assume the situation to be no different in C++. Here it goes:
you can put the signals & slot connections in your class contructor for the plot:
self.connect(self,
SIGNAL('plotMouseMoved(const QMouseEvent&)'),
self.onMouseMoved)
self.connect(self,
SIGNAL('plotMouseReleased(const QMouseEvent&)'),
self.onMouseReleased)
# end of __init__() - nothing more is required here.
def onMouseMoved(self, e):
pass
def on MouseReleased(self,e):
# bind popUp menu event to popUp menu
popupEvent = QContextMenuEvent(QContextMenuEvent.Mouse,e.pos(), False)
if Qt.RightButton == e.button(): # right-mouse button clicked
#you can set you own condition to accept() the pop-Up event and then can create the pop-up menu according to your needs.
popupEvent.accept() # accept the pop-Up event - show the pop-Up menu
#create the menu here
For the C++ code,
i am not very sure what is going wrong.
Thanks
Kaustav.
Bookmarks