Skip to content Skip to sidebar Skip to footer

Integrating A Pyqt3d Window Into A Qmainwindow

We can use QWidget.createWindowContainer to add a 3D view into a QMainWindow (a window with menus, status bar, etc). However, I found that this approach does not work, the windows

Solution 1:

In Approach 1, your scene variable in View3D goes out of scope as soon as the __init__() method ends. It is then garbage collected by Python, leaving nothing to be displayed.

In Approach 2, scene remains in scope throughout the execution of the program, so there's no problem.

I changed the three occurrences of scene in __init__() to self.scene, thereby keeping a reference to it. Approach 1 and Approach 2 now both work as expected.

Approach 1 still gives the error

QOpenGLContext::swapBuffers() called with non-exposed window, behavior is undefined

but it doesn't seem to cause problems.

Post a Comment for "Integrating A Pyqt3d Window Into A Qmainwindow"