enthought / enthought/mayavi

Problem when using QGLWidget

Open
#969 37 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
1.4k
Forks
316
Avg merge
7h 44m
Merged PRs (30d)
5

Description

When setting `QVTKRWIBase = "QGLWidget"` in `vtkmodules/qt/__init__.py` to work around rendering glitches, no graphics are being shown and the following error is generated:

```
QPainter::begin: Paint device returned engine == 0, type: 1
```

In [`tvtk/pyface/ui/qt4/QVTKRenderWindowInteractor.py`](https://github.com/enthought/mayavi/blob/master/tvtk/pyface/ui/qt4/QVTKRenderWindowInteractor.py#L68-L73), there is the following construct:

```python
if PyQtImpl == "PyQt5":
if QVTKRWIBase == "QGLWidget":
try:
from PyQt5.QtWidgets import QOpenGLWidget as QGLWidget
except:
from PyQt5.QtOpenGL import QGLWidget
```
Removing the `try/catch` black to force using the deprecated `QGLWidget` instead of the more modern `QOpenGLWidget` fixes the problem and everything runs smoothly. However, we should of course use `QOpenGLWidget`. But there must be some difference between the two that is causing the error.

I tested this on multiple devices with different types of video cards, I consistently get the error every time.

@larsoner

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.