qtutils: helper code for Qt

These are convenience functions to make using Qt easier.

class OpenGLWidget(format, parent=None, share=None, flags=0)

Bases: PyQt5.QtOpenGL.QGLWidget

Create a Qt Item for 3D OpenGL drawing.

Actual 3D drawing should be done in a overridden _paintGL function in a subclass. The OpenGL viewport used for drawing is in the viewport attribute. Use the updateGL() member function to indicate that the 3D contents need to be updated. The framebuffer format is assumed to have color, depth, and stencil buffers.

create_form(ui_file, parent=None, opengl={}, connections={})

create GUI from .ui file

The parent argument is needed to nest the GUI inside another widget.

The opengl argument contains (object_name, widget_factory) pairs, and uses the widget_factory to create a new (presumably OpenGL) widget inside the GUI widget with the given object_name. The new widget’s object name has a ‘GL’ appended to it so it can be referred to in the connections table.

The connections argument contains (signal, slot) pairs. The signal can be given in a dotted pair representation, i.e., “object_name.signal_name” and the slots can either be a dotted pair, i.e., “object_name.slot_name”, or an explicit reference to the slot.

This Page