Skip to content

Commit

Permalink
Gui: fix 'Recursive repaint' warning when switching 3D views
Browse files Browse the repository at this point in the history
  • Loading branch information
realthunder authored and wwmayer committed May 6, 2020
1 parent 9e11680 commit 58dc5c6
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion src/Gui/Quarter/QuarterWidget.cpp
Expand Up @@ -1043,12 +1043,34 @@ QuarterWidget::redraw(void)
// we're triggering the next paintGL(). Set a flag to remember this
// to avoid that we process the delay queue in paintGL()
PRIVATE(this)->processdelayqueue = false;
#if QT_VERSION >= 0x050500 && QT_VERSION < 0x050600

// When stylesheet is used, there is recursive repaint warning caused by
// repaint() here. It happens when switching active documents. Based on call
// stacks, it happens like this, the repaint event first triggers a series
// calls of QWidgetPrivate::paintSiblingsRecrusive(), and then reaches one of
// the QuarterWidget. From its paintEvent(), it calls
// SoSensorManager::processDelayQueue(), which triggers redraw() of another
// QuarterWidget. And if repaint() is called here, it will trigger another
// series call of QWidgetPrivate::paintSiblingRecursive(), and eventually
// back to the first QuarterWidget, at which time the "Recursive repaint
// detected" Qt warning message will be printed.
//
// Note that, the recursive repaint is not infinite due to setting
// 'processdelayqueue = false' above. However, it does cause annoying
// flickering, and actually crash on Windows.
#if 1
this->viewport()->update();
#else
// #if QT_VERSION >= 0x050500 && QT_VERSION < 0x050600
#if 1
// With Qt 5.5.x there is a major performance problem
this->viewport()->update();
#else
this->viewport()->repaint();
#endif
#endif
}

/*!
Expand Down

0 comments on commit 58dc5c6

Please sign in to comment.