PDA

View Full Version : I want to draw an objcet and I want to use contextMenuEvent of that object.



validator
18th March 2008, 07:51
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...

vasanth
18th March 2008, 08:19
in the mousePressEvent

chk for the mouse button,

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

and add the event

jpn
18th March 2008, 12:47
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.