Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [Closed] QGraphicsView: reimplementing paintEvent stops events
Forum Updated to NodeBB v4.3 + New Features

[Closed] QGraphicsView: reimplementing paintEvent stops events

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 2.6k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    Peter K
    wrote on last edited by
    #1

    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
    renderToFramebuffer();

    // 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
    QGraphicsView::paintEvent(event);
    

    }
    @

    1 Reply Last reply
    0
    • R Offline
      R Offline
      rcari
      wrote on last edited by
      #2

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

      1 Reply Last reply
      0
      • P Offline
        P Offline
        Peter K
        wrote on last edited by
        #3

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

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved