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. How to workaround the "pure virtual method called - QWidget::repaint: Recursive repaint detected" issue?
Forum Updated to NodeBB v4.3 + New Features

How to workaround the "pure virtual method called - QWidget::repaint: Recursive repaint detected" issue?

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 2 Posters 2.2k 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.
  • NiagarerN Offline
    NiagarerN Offline
    Niagarer
    wrote on last edited by
    #1

    Hey,
    In my code, I delete a QGraphicsItem derived object.

                dataExecOutputs.removeOne(d);
                graph->scene()->removeItem(d);
                delete d;
    

    I used it in a QGraphicsScene, but as you can see, I removed it from the scene and the array the object is stored in (dataExecOuputs).
    This works without compiler errors but at runtime, the program crashes after I deleted the object with:

    pure virtual method called
    QWidget::repaint: Recursive repaint detected
    

    This is a known issue, but I can't find a working solution for me.
    Do you have any ideas how I can avoid that crash?
    I have to remove this object when I call a update() function and the object I want to delete is not anymore in another array (so it is only in the dataExecOuputs array anymore and nowhere else).
    Thanks for answers!

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      What makes it mandatory for you to do that in the update method ?

      Because that's what is triggering the recursive repaint: you are running update in which you trigger an update again etc.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      NiagarerN 1 Reply Last reply
      0
      • SGaistS SGaist

        Hi,

        What makes it mandatory for you to do that in the update method ?

        Because that's what is triggering the recursive repaint: you are running update in which you trigger an update again etc.

        NiagarerN Offline
        NiagarerN Offline
        Niagarer
        wrote on last edited by Niagarer
        #3

        @SGaist
        Where do I do this?
        With update I mean a custom update() method by me, not the actual update of the class itself. I call my custom update updateInputs() when I change something in a specific lineEdit in a formular. That's the weird thing with the bug, that I even do not call update manually. When comment out the delete line, everything works, so the delete command causes this error, but this is a known issue since qt 5 I guess, I am not the first one with these weird recursive repaint outputs. I just would like to know how I can get around it :/

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          That's the kind of detail that is pretty important.

          If you can provide a minimal compilable example that shows that behaviour, that would avoid having to guess what is happening while guessing how your application is currently running.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          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