views:

193

answers:

1

Hello everyone,

I am using the Qt 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 OverlayViewport 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?

Best Regards.

A: 

I found the culprit. It seems that this was a bug in Qt. QGraphicsView does not set the accepted flag of mouseMoveEvents appropriately. This happens for mouseMoveEvents only, the other events are fine. It is reported to Qt and waiting to be fixed.

erelender