[Qt-interest] QGraphicsView accepted events
Ender EREL
erelender at yahoo.com
Fri Jan 29 16:55:53 CET 2010
Hello everyone,
I am using the graphics view framework to create a scene and attach
multiple views to the same scene, where these views render a 3D
openscenegraph scene as background and the 2D drawings are kind of overlays.
I am trying to intercept mouse/key events in my MyView class (inherits
QGraphicsView) and navigate the 3D scene accordingly. Below is a sample
event handler:
void OverlayViewport::mouseMoveEvent( QMouseEvent * event )
{
QGraphicsView::mouseMoveEvent(event);
if (event->isAccepted())
{
return;
}
3D_Scene_Stuff_Code();
}
But the events are always accepted, therefore my 3D scene stuff code
never executes. If I remove the isAccepted() check, my code always executes.
What i want to achieve is, let the scene do its stuff like selection,
dragging vs, and if it does not do anything (does not accept the event),
do my 3D stuff.
so, here are my questions:
1 - Am I on the wrong path here?
2 - Should I forward the events to the scene that the view is attached
and do my stuff if event is not accepted by the scene?
3 - If not 2, how should I proceed?
Thanks in advance.
Best Regards,
Ender EREL
More information about the Qt-interest-old
mailing list