QWidget::repaint: Recursive repaint detected
-
Where can I learn more about this error ? any online documentation ? How can I debug this error ?
-
Did you override the paintEvent?
-
@jsulm yes, declared as
void paintEvent(QPaintEvent *e) Q_DECL_OVERRIDE; -
Can you post its content?
-
void OpenGLWidget::paintEvent(QPaintEvent *e){ QPainter p; // updateGL(); p.begin(this); p.setPen(Qt::white); p.drawText(QPointF(50,50),"Test"); p.end(); }
-
could it be that the QOpenGLWidget is initialized before menubar() in the MainWindow.h , thus making a conflict ?
-
updateGL
causes apaintEvent
which calls updateGL, which causes paintEvent which...
Yes, this is recursive. -
updateGL
causes apaintEvent
which calls updateGL, which causes paintEvent which...
Yes, this is recursive.@Chris-Kawa in case you didnt notice, the call to updateGL() is commented out.
-
Ah, ok. I thought it was commented out because it caused the error.
You can always put a breakpoint in the line printing the error and look at the call stack to see where is it coming from. It could be a repaint called from non-ui thread or a direct call to paintEvent from somewhere.