Results 1 to 5 of 5

Thread: QWT right click window.. (Context Menu)

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QWT right click window.. (Context Menu)

    Is menu a member variable of your class ??

    I guess u have not declared it

  2. #2
    Join Date
    Apr 2008
    Location
    Bangalore, India
    Posts
    7
    Qt products
    Qt3
    Platforms
    Unix/X11

    Default Re: QWT right click window.. (Context Menu)

    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.

Similar Threads

  1. Double click resize window disable
    By MarkoSan in forum Qt Programming
    Replies: 3
    Last Post: 13th May 2008, 11:35
  2. Set a window as child at runtime
    By sabeesh in forum Qt Programming
    Replies: 1
    Last Post: 26th November 2007, 09:30
  3. close window when click on a label
    By sabeesh in forum Qt Programming
    Replies: 3
    Last Post: 29th October 2007, 07:35
  4. QTextBrowser - click on link - closes window
    By bruccutler in forum Newbie
    Replies: 2
    Last Post: 19th June 2007, 20:39
  5. Replies: 1
    Last Post: 9th February 2007, 09:41

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.