QVTKOpenGLNativeWidget breaks painting of parent QWidget and all siblings
QVTKOpenGLNativeWidget is the central widget in
QMainWindow it works fine, as shown in the sample RenderWindowNoUiFile. However, if sibling
QWidgets are present in the same layout, then the siblings do not redraw upon window resize or upon user interaction. The widgets do receive their
paintEvents. However, none of them redraw, unless the update was triggered by interaction with
To reproduce this effect, add a
QPushButton to the main window as follows:
qtw = new QVTKOpenGLNativeWidget(ui->centralwidget); qpb = new QPushButton("hello button", ui->centralwidget);
You will notice that the button does not redraw when clicked, and central widget does not redraw if the window is resized. The following versions of software are used: VTK 8.2, Qt 5.12.6, Ubuntu 18.04.3, GCC 7.4.0.
I found a quick fix, but not sure if it breaks anything else in VTK's rendering. When initializing
QSurfaceFormat, I set alpha buffer size to zero:
QSurfaceFormat fmt = QVTKOpenGLNativeWidget::defaultFormat(); fmt.setAlphaBufferSize(0); QSurfaceFormat::setDefaultFormat(fmt);
Also, in the current commit,
QVTKOpenGLNativeWidget does not compile.
Thank you for your time.