Results 1 to 3 of 3

Thread: I want to draw an objcet and I want to use contextMenuEvent of that object.

  1. #1
    Join Date
    Feb 2008
    Posts
    36
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default I want to draw an objcet and I want to use contextMenuEvent of that object.

    Hi. I create a class that its name is Car. Car class has a method .The name of this method Drawcar with openGL. Drawcar method draws the car. when I click mouse right button on the car shape .I want to show a menu .How can I do it Help...

  2. #2
    Join Date
    Jul 2007
    Location
    Bangalore, India
    Posts
    13
    Thanks
    4
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: I want to draw an objcet and I want to use contextMenuEvent of that object.

    in the mousePressEvent

    chk for the mouse button,

    if(event->button()==Qt::Rightbutton)

    and add the event

  3. #3
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,518 Times in 1,388 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: I want to draw an objcet and I want to use contextMenuEvent of that object.

    Actually, there's a specialized handler for context menu, namely QWidget::contextMenuEvent(). The actions required to open context menus vary between platforms; for example, on Windows, pressing the menu button or clicking the right mouse button will cause this event to be sent. QWidget::mousePressEvent() would only cover the latter case.
    J-P Nurmi

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.