Important: Please read the Qt Code of Conduct -

QGraphicsView and QGraphicsScene events

  • Hello,

    I have a problem to understand how events are propagated to the graphicsScene and GraphicsView.

    I have a OpenGl view at the background of the QGraphicsScene (drawbackground event) and some widgets which are in
    my GraphicsScene with transparency.

    When I clicked on a push_button of a widget inside the scene, the event is propagated in the OPENGL view before
    the widget push button

    I tried 2 things :

    @bool QGraphicsView::viewportEvent(QEvent *event){

    bool tag = QGraphicsView::viewportEvent(event);
    QAdapterScene * pAdapterScene = dynamic_cast<QAdapterScene*>(scene());
    if (pAdapterScene) {
    //OpenGL events

    return tag;



    bool QAdapterScene::event(QEvent *event){
    bool tag = QGraphicsScene::event(event);
    //OpenGL events

     return tag;


    But each time, events on widget were received after le map event function.

    Do you know how I can resolve my problem ?
    Thanks for your help

Log in to reply