From d960783a02bf32a3e5b959c68d78ec276c34f966 Mon Sep 17 00:00:00 2001 From: "Zheng, Lei" Date: Sat, 2 May 2020 11:01:32 +0000 Subject: [PATCH] Gui: fix 'Recursive repaint' warning when switching 3D views --- src/Gui/Quarter/QuarterWidget.cpp | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/src/Gui/Quarter/QuarterWidget.cpp b/src/Gui/Quarter/QuarterWidget.cpp index b76266b0b7..7edfb0ca97 100644 --- a/src/Gui/Quarter/QuarterWidget.cpp +++ b/src/Gui/Quarter/QuarterWidget.cpp @@ -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 } /*!