Important: Please read the Qt Code of Conduct -

[Closed] QGraphicsView: reimplementing paintEvent stops events

  • I want to reimplement QGraphicsView::paintEvent() in my derived class, as shown in the code example below, such that it no longer renders to the viewport (a QGLWidget), but to a QGLFramebufferObject through QGraphicsview::render(). The resulting texture will then be used as an overlay in a dedicated rendering thread.

    This involves not calling QGraphicsView::paintEvent() from my reimplemented paintEvent, as that would make it draw directly onto the viewport and destroying what is already there.

    This however stops any paintEvent()'s from being sent, thus stalling the graphics of the interface.
    Q: How can I regain the paintEvent()'s, without resorting to timers?

    void TestGraphicsView::paintEvent(QPaintEvent* event)
    // Render to QGLFramebufferObject for the purpose of being used as an overlay elsewhere

    // I do not want to call the following line, as it destroys what is already on screen,
    // however not doing so stops the paintEvent()'s


  • Have you tried calling @event->accept();@ ?

  • No, I have not. However, I have abandoned this so the thread is obsolete. It can be closed.

Log in to reply