Skip to content

PythonQt.QtGui.QOpenGLWidget

QOpenGLWidget

PythonQtInstanceWrapper object

Native bases: PythonQtInstanceWrapper

Supplemental documentation: Qt 5 reference:

Detailed Description

QOpenGLWidget provides functionality for displaying OpenGL graphics integrated into a Qt application. It is very simple to use: Make your class inherit from it and use the subclass like any other QWidget, except that you have the choice between using QPainter and standard OpenGL rendering commands.

QOpenGLWidget provides three convenient virtual functions that you can reimplement in your subclass to perform the typical OpenGL tasks:

  • paintGL() - Renders the OpenGL scene. Gets called whenever the widget needs to be updated.
  • resizeGL() - Sets up the OpenGL viewport, projection, etc. Gets called whenever the widget has been resized (and also when it is shown for the first time because all newly created widgets get a resize event automatically).
  • initializeGL() - Sets up the OpenGL resources and state. Gets called once before the first time resizeGL() or paintGL() is called.

If you need to trigger a repaint from places other than paintGL() (a typical example is when using timers to animate scenes), you should call the widget's update() function to schedule an update.

Your widget's OpenGL rendering context is made current when paintGL(), resizeGL(), or initializeGL() is called. If you need to call the standard OpenGL API functions from other places (e.g. in your widget's constructor or in your own paint functions), you must call makeCurrent() first.

All rendering happens into an OpenGL framebuffer object. makeCurrent() ensure that it is bound in the context. Keep this in mind when creating and binding additional framebuffer objects in the rendering code in paintGL(). Never re-bind the framebuffer with ID 0. Instead, call defaultFramebufferObject() to get the ID that should be bound.

QOpenGLWidget allows using different OpenGL versions and profiles when the platform supports it. Just set the requested format via setFormat(). Keep in mind however that having multiple QOpenGLWidget instances in the same window requires that they all use the same format, or at least formats that do not make the contexts non-sharable. To overcome this issue, prefer using QSurfaceFormat::setDefaultFormat() instead of setFormat().

Note: Calling QSurfaceFormat::setDefaultFormat() before constructing the QApplication instance is mandatory on some platforms (for example, macOS) when an OpenGL core profile context is requested. This is to ensure that resource sharing between contexts stays functional as all internal contexts are created using the correct version and profile.

Painting Techniques

As described above, subclass QOpenGLWidget to render pure 3D content in the following way:

  • Reimplement the initializeGL() and resizeGL() functions to set up the OpenGL state and provide a perspective transformation.
  • Reimplement paintGL() to paint the 3D scene, calling only OpenGL functions.

It is also possible to draw 2D graphics onto a QOpenGLWidget subclass using QPainter:

  • In paintGL(), instead of issuing OpenGL commands, construct a QPainter object for use on the widget.
  • Draw primitives using QPainter's member functions.
  • Direct OpenGL commands can still be issued. However, you must make sure these are enclosed by a call to the painter's beginNativePainting() and endNativePainting().

When performing drawing using QPainter only, it is also possible to perform the painting like it is done for ordinary widgets: by reimplementing paintEvent().

  • Reimplement the paintEvent() function.
  • Construct a QPainter object targeting the widget. Either pass the widget to the constructor or the QPainter::begin() function.
  • Draw primitives using QPainter's member functions.
  • Painting finishes then the QPainter instance is destroyed. Alternatively, call QPainter::end() explicitly.

OpenGL Function Calls, Headers and QOpenGLFunctions

When making OpenGL function calls, it is strongly recommended to avoid calling the functions directly. Instead, prefer using QOpenGLFunctions (when making portable applications) or the versioned variants (for example, QOpenGLFunctions_3_2_Core and similar, when targeting modern, desktop-only OpenGL). This way the application will work correctly in all Qt build configurations, including the ones that perform dynamic OpenGL implementation loading which means applications are not directly linking to an GL implementation and thus direct function calls are not feasible.

In paintGL() the current context is always accessible by caling QOpenGLContext::currentContext(). From this context an already initialized, ready-to-be-used QOpenGLFunctions instance is retrievable by calling QOpenGLContext::functions(). An alternative to prefixing every GL call is to inherit from QOpenGLFunctions and call QOpenGLFunctions::initializeOpenGLFunctions() in initializeGL().

As for the OpenGL headers, note that in most cases there will be no need to directly include any headers like GL.h. The OpenGL-related Qt headers will include qopengl.h which will in turn include an appropriate header for the system. This might be an OpenGL ES 3.x or 2.0 header, the highest version that is available, or a system-provided gl.h. In addition, a copy of the extension headers (called glext.h on some systems) is provided as part of Qt both for OpenGL and OpenGL ES. These will get included automatically on platforms where feasible. This means that constants and function pointer typedefs from ARB, EXT, OES extensions are automatically available.

Code Examples

To get started, the simplest QOpenGLWidget subclass could like like the following:

class MyGLWidget : public QOpenGLWidget
{
public:
    MyGLWidget(QWidget *parent) : QOpenGLWidget(parent) { }

protected:
    void initializeGL() override
    {
        // Set up the rendering context, load shaders and other resources, etc.:
        QOpenGLFunctions *f = QOpenGLContext::currentContext()->functions();
        f->glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
        ...
    }

    void resizeGL(int w, int h) override
    {
        // Update projection matrix and other size related settings:
        m_projection.setToIdentity();
        m_projection.perspective(45.0f, w / float(h), 0.01f, 100.0f);
        ...
    }

    void paintGL() override
    {
        // Draw the scene:
        QOpenGLFunctions *f = QOpenGLContext::currentContext()->functions();
        f->glClear(GL_COLOR_BUFFER_BIT);
        ...
    }

};

Alternatively, the prefixing of each and every OpenGL call can be avoided by deriving from QOpenGLFunctions instead:

class MyGLWidget : public QOpenGLWidget, protected QOpenGLFunctions
{
    ...
    void initializeGL() override
    {
        initializeOpenGLFunctions();
        glClearColor(...);
        ...
    }
    ...
};

To get a context compatible with a given OpenGL version or profile, or to request depth and stencil buffers, call setFormat():

QOpenGLWidget *widget = new QOpenGLWidget(parent);
QSurfaceFormat format;
format.setDepthBufferSize(24);
format.setStencilBufferSize(8);
format.setVersion(3, 2);
format.setProfile(QSurfaceFormat::CoreProfile);
widget->setFormat(format); // must be called before the widget or its parent window gets shown

With OpenGL 3.0+ contexts, when portability is not important, the versioned QOpenGLFunctions variants give easy access to all the modern OpenGL functions available in a given version:

    ...
    void paintGL() override
    {
        QOpenGLFunctions_3_2_Core *f = QOpenGLContext::currentContext()->versionFunctions<QOpenGLFunctions_3_2_Core>();
        ...
        f->glDrawArraysInstanced(...);
        ...
    }
    ...

As described above, it is simpler and more robust to set the requested format globally so that it applies to all windows and contexts during the lifetime of the application. Below is an example of this:

int main(int argc, char **argv)
{
    QApplication app(argc, argv);

    QSurfaceFormat format;
    format.setDepthBufferSize(24);
    format.setStencilBufferSize(8);
    format.setVersion(3, 2);
    format.setProfile(QSurfaceFormat::CoreProfile);
    QSurfaceFormat::setDefaultFormat(format);

    MyWidget widget;
    widget.show();

    return app.exec();
}

Relation to QGLWidget

The legacy QtOpenGL module (classes prefixed with QGL) provides a widget called QGLWidget. QOpenGLWidget is intended to be a modern replacement for it. Therefore, especially in new applications, the general recommendation is to use QOpenGLWidget.

While the API is very similar, there is an important difference between the two: QOpenGLWidget always renders offscreen, using framebuffer objects. QGLWidget on the other hand uses a native window and surface. The latter causes issues when using it in complex user interfaces since, depending on the platform, such native child widgets may have various limitations, regarding stacking orders for example. QOpenGLWidget avoids this by not creating a separate native window.

Due to being backed by a framebuffer object, the behavior of QOpenGLWidget is very similar to QOpenGLWindow with the update behavior set to PartialUpdateBlit or PartialUpdateBlend. This means that the contents are preserved between paintGL() calls so that incremental rendering is possible. With QGLWidget (and naturally QOpenGLWindow with the default update behavior) this is usually not the case because swapping the buffers leaves the back buffer with undefined contents.

Note: Most applications do not need incremental rendering because they will render everything in the view on every paint call. In this case it is important to call glClear() as early as possible in paintGL(). This helps mobile GPUs that use a tile-based architecture to recognize that the tile buffer does not need to be reloaded with the framebuffer's previous contents. Omitting the clear call can lead to significant performance drops on such systems.

Note: Avoid calling winId() on a QOpenGLWidget. This function triggers the creation of a native window, resulting in reduced performance and possibly rendering glitches.

Differences to QGLWidget

Besides the main conceptual difference of being backed by a framebuffer object, there are a number of smaller, internal differences between QOpenGLWidget and the older QGLWidget:

  • OpenGL state when invoking paintGL(). QOpenGLWidget sets up the viewport via glViewport(). It does not perform any clearing.
  • Clearing when starting to paint via QPainter. Unlike regular widgets, QGLWidget defaulted to a value of true for autoFillBackground. It then performed clearing to the palette's background color every time QPainter::begin() was used. QOpenGLWidget does not follow this: autoFillBackground defaults to false, like for any other widget. The only exception is when being used as a viewport for other widgets like QGraphicsView. In such a case autoFillBackground will be automatically set to true to ensure compatibility with QGLWidget-based viewports.

Multisampling

To enable multisampling, set the number of requested samples on the QSurfaceFormat that is passed to setFormat(). On systems that do not support it the request may get ignored.

Multisampling support requires support for multisampled renderbuffers and framebuffer blits. On OpenGL ES 2.0 implementations it is likely that these will not be present. This means that multisampling will not be available. With modern OpenGL versions and OpenGL ES 3.0 and up this is usually not a problem anymore.

Threading

Performing offscreen rendering on worker threads, for example to generate textures that are then used in the GUI/main thread in paintGL(), are supported by exposing the widget's QOpenGLContext so that additional contexts sharing with it can be created on each thread.

Drawing directly to the QOpenGLWidget's framebuffer outside the GUI/main thread is possible by reimplementing paintEvent() to do nothing. The context's thread affinity has to be changed via QObject::moveToThread(). After that, makeCurrent() and doneCurrent() are usable on the worker thread. Be careful to move the context back to the GUI/main thread afterwards.

Unlike QGLWidget, triggering a buffer swap just for the QOpenGLWidget is not possible since there is no real, onscreen native surface for it. Instead, it is up to the widget stack to manage composition and buffer swaps on the gui thread. When a thread is done updating the framebuffer, call update() on the GUI/main thread to schedule composition.

Extra care has to be taken to avoid using the framebuffer when the GUI/main thread is performing compositing. The signals aboutToCompose() and frameSwapped() will be emitted when the composition is starting and ending. They are emitted on the GUI/main thread. This means that by using a direct connection aboutToCompose() can block the GUI/main thread until the worker thread has finished its rendering. After that, the worker thread must perform no further rendering until the frameSwapped() signal is emitted. If this is not acceptable, the worker thread has to implement a double buffering mechanism. This involves drawing using an alternative render target, that is fully controlled by the thread, e.g. an additional framebuffer object, and blitting to the QOpenGLWidget's framebuffer at a suitable time.

Context Sharing

When multiple QOpenGLWidgets are added as children to the same top-level widget, their contexts will share with each other. This does not apply for QOpenGLWidget instances that belong to different windows.

This means that all QOpenGLWidgets in the same window can access each other's sharable resources, like textures, and there is no need for an extra "global share" context, as was the case with QGLWidget.

To set up sharing between QOpenGLWidget instances belonging to different windows, set the Qt::AA_ShareOpenGLContexts application attribute before instantiating QApplication. This will trigger sharing between all QOpenGLWidget instances without any further steps.

Creating extra QOpenGLContext instances that share resources like textures with the QOpenGLWidget's context is also possible. Simply pass the pointer returned from context() to QOpenGLContext::setShareContext() before calling QOpenGLContext::create(). The resulting context can also be used on a different thread, allowing threaded generation of textures and asynchronous texture uploads.

Note that QOpenGLWidget expects a standard conformant implementation of resource sharing when it comes to the underlying graphics drivers. For example, some drivers, in particular for mobile and embedded hardware, have issues with setting up sharing between an existing context and others that are created later. Some other drivers may behave in unexpected ways when trying to utilize shared resources between different threads.

Resource Initialization and Cleanup

The QOpenGLWidget's associated OpenGL context is guaranteed to be current whenever initializeGL() and paintGL() are invoked. Do not attempt to create OpenGL resources before initializeGL() is called. For example, attempting to compile shaders, initialize vertex buffer objects or upload texture data will fail when done in a subclass's constructor. These operations must be deferred to initializeGL(). Some of Qt's OpenGL helper classes, like QOpenGLBuffer or QOpenGLVertexArrayObject, have a matching deferred behavior: they can be instantiated without a context, but all initialization is deferred until a create(), or similar, call. This means that they can be used as normal (non-pointer) member variables in a QOpenGLWidget subclass, but the create() or similar function can only be called from initializeGL(). Be aware however that not all classes are designed like this. When in doubt, make the member variable a pointer and create and destroy the instance dynamically in initializeGL() and the destructor, respectively.

Releasing the resources also needs the context to be current. Therefore destructors that perform such cleanup are expected to call makeCurrent() before moving on to destroy any OpenGL resources or wrappers. Avoid deferred deletion via deleteLater() or the parenting mechanism of QObject. There is no guarantee the correct context will be current at the time the instance in question is really destroyed.

A typical subclass will therefore often look like the following when it comes to resource initialization and destruction:

class MyGLWidget : public QOpenGLWidget
{
    ...

private:
    QOpenGLVertexArrayObject m_vao;
    QOpenGLBuffer m_vbo;
    QOpenGLShaderProgram *m_program;
    QOpenGLShader *m_shader;
    QOpenGLTexture *m_texture;
};

MyGLWidget::MyGLWidget()
    : m_program(0), m_shader(0), m_texture(0)
{
    // No OpenGL resource initialization is done here.
}

MyGLWidget::~MyGLWidget()
{
    // Make sure the context is current and then explicitly
    // destroy all underlying OpenGL resources.
    makeCurrent();

    delete m_texture;
    delete m_shader;
    delete m_program;

    m_vbo.destroy();
    m_vao.destroy();

    doneCurrent();
}

void MyGLWidget::initializeGL()
{
    m_vao.create();
    if (m_vao.isCreated())
        m_vao.bind();

    m_vbo.create();
    m_vbo.bind();
    m_vbo.allocate(...);

    m_texture = new QOpenGLTexture(QImage(...));

    m_shader = new QOpenGLShader(...);
    m_program = new QOpenGLShaderProgram(...);

    ...
}

This is naturally not the only possible solution. One alternative is to use the aboutToBeDestroyed() signal of QOpenGLContext. By connecting a slot, using direct connection, to this signal, it is possible to perform cleanup whenever the underlying native context handle, or the entire QOpenGLContext instance, is going to be released. The following snippet is in principle equivalent to the previous one:

void MyGLWidget::initializeGL()
{
    // context() and QOpenGLContext::currentContext() are equivalent when called from initializeGL or paintGL.
    connect(context(), &QOpenGLContext::aboutToBeDestroyed, this, &MyGLWidget::cleanup);
}

void MyGLWidget::cleanup()
{
    makeCurrent();
    delete m_texture;
    m_texture = 0;
    ...
    doneCurrent();
}

Note: For widgets that change their associated top-level window multiple times during their lifetime, a combined approach is essential. Whenever the widget or a parent of it gets reparented so that the top-level window becomes different, the widget's associated context is destroyed and a new one is created. This is then followed by a call to initializeGL() where all OpenGL resources must get reinitialized. Due to this the only option to perform proper cleanup is to connect to the context's aboutToBeDestroyed() signal. Note that the context in question may not be the current one when the signal gets emitted. Therefore it is good practice to call makeCurrent() in the connected slot. Additionally, the same cleanup steps must be performed from the derived class' destructor, since the slot connected to the signal will not get invoked when the widget is being destroyed.

Note: When Qt::AA_ShareOpenGLContexts is set, the widget's context never changes, not even when reparenting because the widget's associated texture is guaranteed to be accessible also from the new top-level's context.

Proper cleanup is especially important due to context sharing. Even though each QOpenGLWidget's associated context is destroyed together with the QOpenGLWidget, the sharable resources in that context, like textures, will stay valid until the top-level window, in which the QOpenGLWidget lived, is destroyed. Additionally, settings like Qt::AA_ShareOpenGLContexts and some Qt modules may trigger an even wider scope for sharing contexts, potentially leading to keeping the resources in question alive for the entire lifetime of the application. Therefore the safest and most robust is always to perform explicit cleanup for all resources and resource wrappers used in the QOpenGLWidget.

Limitations

Putting other widgets underneath and making the QOpenGLWidget transparent will not lead to the expected results: The widgets underneath will not be visible. This is because in practice the QOpenGLWidget is drawn before all other regular, non-OpenGL widgets, and so see-through type of solutions are not feasible. Other type of layouts, like having widgets on top of the QOpenGLWidget, will function as expected.

When absolutely necessary, this limitation can be overcome by setting the Qt::WA_AlwaysStackOnTop attribute on the QOpenGLWidget. Be aware however that this breaks stacking order, for example it will not be possible to have other widgets on top of the QOpenGLWidget, so it should only be used in situations where a semi-transparent QOpenGLWidget with other widgets visible underneath is required.

Note that this does not apply when there are no other widgets underneath and the intention is to have a semi-transparent window. In that case the traditional approach of setting Qt::WA_TranslucentBackground on the top-level window is sufficient. Note that if the transparent areas are only desired in the QOpenGLWidget, then Qt::WA_NoSystemBackground will need to be turned back to false after enabling Qt::WA_TranslucentBackground. Additionally, requesting an alpha channel for the QOpenGLWidget's context via setFormat() may be necessary too, depending on the system.

QOpenGLWidget supports multiple update behaviors, just like QOpenGLWindow. In preserved mode the rendered content from the previous paintGL() call is available in the next one, allowing incremental rendering. In non-preserved mode the content is lost and paintGL() implementations are expected to redraw everything in the view.

Before Qt 5.5 the default behavior of QOpenGLWidget was to preserve the rendered contents between paintGL() calls. Since Qt 5.5 the default behavior is non-preserved because this provides better performance and the majority of applications have no need for the previous content. This also resembles the semantics of an OpenGL-based QWindow and matches the default behavior of QOpenGLWindow in that the color and ancillary buffers are invalidated for each frame. To restore the preserved behavior, call setUpdateBehavior() with PartialUpdate.

Note: Displaying a QOpenGLWidget requires an alpha channel in the associated top-level window's backing store due to the way composition with other QWidget-based content works. If there is no alpha channel, the content rendered by the QOpenGLWidget will not be visible. This can become particularly relevant on Linux/X11 in remote display setups (such as, with Xvnc), when using a color depth lower than 24. For example, a color depth of 16 will typically map to using a backing store image with the format QImage::Format_RGB16 (RGB565), leaving no room for an alpha channel. Therefore, if experiencing problems with getting the contents of a QOpenGLWidget composited correctly with other the widgets in the window, make sure the server (such as, vncserver) is configured with a 24 or 32 bit depth instead of 16.

Alternatives

Adding a QOpenGLWidget into a window turns on OpenGL-based compositing for the entire window. In some special cases this may not be ideal, and the old QGLWidget-style behavior with a separate, native child window is desired. Desktop applications that understand the limitations of this approach (for example when it comes to overlaps, transparency, scroll views and MDI areas), can use QOpenGLWindow with QWidget::createWindowContainer(). This is a modern alternative to QGLWidget and is faster than QOpenGLWidget due to the lack of the additional composition step. It is strongly recommended to limit the usage of this approach to cases where there is no other choice. Note that this option is not suitable for most embedded and mobile platforms, and it is known to have issues on certain desktop platforms (e.g. macOS) too. The stable, cross-platform solution is always QOpenGLWidget.

OpenGL is a trademark of Silicon Graphics, Inc. in the United States and other countries.

Source: https://doc.qt.io/archives/qt-5.15/qopenglwidget.html

Complete member index

Every captured member retains its own identity. Identical captured declaration text is linked once; this does not establish native inheritance or interchangeable objects.

Member Kind Signature Summary
DrawChildren attribute Any (shared captured text)
DrawWindowBackground attribute Any (shared captured text)
IgnoreMask attribute Any (shared captured text)
NoPartialUpdate attribute Any
PaintDeviceMetric attribute type Convert a number or string to an integer, or return 0 if no arguments are given. (shared captured text)
PartialUpdate attribute Any
PdmDepth attribute Any (shared captured text)
PdmDevicePixelRatio attribute Any (shared captured text)
PdmDevicePixelRatioScaled attribute Any (shared captured text)
PdmDpiX attribute Any (shared captured text)
PdmDpiY attribute Any (shared captured text)
PdmHeight attribute Any (shared captured text)
PdmHeightMM attribute Any (shared captured text)
PdmNumColors attribute Any (shared captured text)
PdmPhysicalDpiX attribute Any (shared captured text)
PdmPhysicalDpiY attribute Any (shared captured text)
PdmWidth attribute Any (shared captured text)
PdmWidthMM attribute Any (shared captured text)
RenderFlag attribute type Convert a number or string to an integer, or return 0 if no arguments are given. (shared captured text)
RenderFlags attribute type Convert a number or string to an integer, or return 0 if no arguments are given. (shared captured text)
UpdateBehavior attribute type Convert a number or string to an integer, or return 0 if no arguments are given.
__init__ function (self, *args: Any, **kwargs: Any) -> None Native constructor; consult class documentation for supported overloads. (shared captured text)
aboutToCompose function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.QtGui.QOpenGLWidget.aboutToCompose; argument details are not documented.
aboutToResize function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.QtGui.QOpenGLWidget.aboutToResize; argument details are not documented.
acceptDrops attribute Any (shared captured text)
accessibleDescription attribute Any (shared captured text)
accessibleName attribute Any (shared captured text)
actionEvent function (self, event: Any) -> Any (shared captured text)
actions function (self) -> tuple X.actions() -> tuple (shared captured text)
activateWindow function (self) -> Any (shared captured text)
addAction function (self, action: Any) -> Any (shared captured text)
addActions function (self, actions: Any) -> Any (shared captured text)
adjustSize function (self) -> Any (shared captured text)
autoFillBackground attribute Any (shared captured text)
backgroundRole function (self) -> Any (shared captured text)
backingStore function (self) -> Any X.backingStore() -> PythonQt.QtGui.QBackingStore (shared captured text)
baseSize attribute QSize (shared captured text)
blockSignals function (self, b: Any) -> bool X.blockSignals(b) -> bool (shared captured text)
changeEvent function (self, arg__1: Any) -> Any (shared captured text)
childAt function (self, x: Any, y: Any) -> Any X.childAt(x, y) -> PythonQt.QtGui.QWidget (shared captured text)
childEvent function (self, event: Any) -> Any (shared captured text)
children function (self) -> tuple X.children() -> tuple (shared captured text)
childrenRect attribute QRect (shared captured text)
childrenRegion attribute QRegion (shared captured text)
className function (self, *args: Any, **kwargs: Any) -> Any Return the classname of the object (shared captured text)
clearFocus function (self) -> Any (shared captured text)
clearMask function (self) -> Any (shared captured text)
close function (self) -> bool X.close() -> bool (shared captured text)
closeEvent function (self, event: Any) -> Any (shared captured text)
colorCount function (self) -> int X.colorCount() -> int (shared captured text)
connect function (self, signal: Any, receiver: Any, slot: Any, type: Any) -> bool X.connect(signal, receiver, slot, type) -> bool (shared captured text)
contentsMargins function (self) -> Any X.contentsMargins() -> PythonQt.QtGui.QMargins (shared captured text)
contentsRect function (self) -> Any X.contentsRect() -> PythonQt.QtCore.QRect (shared captured text)
context function (self) -> Any X.context() -> PythonQt.QtGui.QOpenGLContext
contextMenuEvent function (self, event: Any) -> Any (shared captured text)
contextMenuPolicy attribute Any (shared captured text)
createWinId function (self) -> Any (shared captured text)
createWindowContainer function (self, window: Any, parent: Any, arg2: flags) -> Any X.createWindowContainer(window, parent, flags) -> PythonQt.QtGui.QWidget (shared captured text)
cursor attribute QCursor (shared captured text)
customContextMenuRequested function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.QtGui.QOpenGLWidget.customContextMenuRequested; argument details are not documented.
customEvent function (self, event: Any) -> Any (shared captured text)
defaultFramebufferObject function (self) -> int X.defaultFramebufferObject() -> int
delete function (self, *args: Any, **kwargs: Any) -> Any Deletes the C++ object (at your own risk, my friend!) (shared captured text)
deleteLater function (self) -> Any (shared captured text)
depth function (self) -> int X.depth() -> int (shared captured text)
destroy function (self, destroyWindow: Any, destroySubWindows: Any) -> Any X.destroy(destroyWindow, destroySubWindows) (shared captured text)
destroyed function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.QtGui.QOpenGLWidget.destroyed; argument details are not documented.
devType function (self) -> int X.devType() -> int (shared captured text)
devicePixelRatio function (self) -> int X.devicePixelRatio() -> int (shared captured text)
devicePixelRatioF function (self) -> float X.devicePixelRatioF() -> float (shared captured text)
devicePixelRatioFScale function (self) -> float X.devicePixelRatioFScale() -> float (shared captured text)
disconnect function (self, signal: Any, receiver: Any, slot: Any) -> bool X.disconnect(signal, receiver, slot) -> bool (shared captured text)
doneCurrent function (self) -> None Releases the context.
dragEnterEvent function (self, event: Any) -> Any (shared captured text)
dragLeaveEvent function (self, event: Any) -> Any (shared captured text)
dragMoveEvent function (self, event: Any) -> Any (shared captured text)
dropEvent function (self, event: Any) -> Any (shared captured text)
dumpObjectInfo function (self) -> Any (shared captured text)
dumpObjectTree function (self) -> Any (shared captured text)
dynamicPropertyNames function (self) -> Any (shared captured text)
effectiveWinId function (self) -> int X.effectiveWinId() -> int (shared captured text)
enabled attribute Any (shared captured text)
ensurePolished function (self) -> Any (shared captured text)
enterEvent function (self, event: Any) -> Any (shared captured text)
event function (self, e: Any) -> bool X.event(e) -> bool
eventFilter function (self, watched: Any, event: Any) -> bool X.eventFilter(watched, event) -> bool (shared captured text)
findChild function (self, type: Any, name: Any) -> Any X.findChild(type, name) -> PythonQt.private.QObject (shared captured text)
findChildren function (self, type: Any, name: Any) -> tuple X.findChildren(type, name) -> tuple (shared captured text)
focus attribute Any (shared captured text)
focusInEvent function (self, event: Any) -> Any (shared captured text)
focusNextChild function (self) -> bool X.focusNextChild() -> bool (shared captured text)
focusNextPrevChild function (self, next: Any) -> bool X.focusNextPrevChild(next) -> bool (shared captured text)
focusOutEvent function (self, event: Any) -> Any (shared captured text)
focusPolicy attribute Any (shared captured text)
focusPreviousChild function (self) -> bool X.focusPreviousChild() -> bool (shared captured text)
focusProxy function (self) -> Any X.focusProxy() -> PythonQt.QtGui.QWidget (shared captured text)
focusWidget function (self) -> Any X.focusWidget() -> PythonQt.QtGui.QWidget (shared captured text)
font attribute QFont (shared captured text)
fontInfo function (self) -> Any X.fontInfo() -> PythonQt.QtGui.QFontInfo (shared captured text)
fontMetrics function (self) -> Any X.fontMetrics() -> PythonQt.QtGui.QFontMetrics (shared captured text)
foregroundRole function (self) -> Any (shared captured text)
format function (self) -> Any X.format() -> PythonQt.QtGui.QSurfaceFormat
frameGeometry attribute QRect (shared captured text)
frameSize attribute QSize (shared captured text)
frameSwapped function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.QtGui.QOpenGLWidget.frameSwapped; argument details are not documented.
fullScreen attribute Any (shared captured text)
geometry attribute QRect (shared captured text)
grab function (self, rectangle: Any) -> Any X.grab(rectangle) -> PythonQt.QtGui.QPixmap (shared captured text)
grabFramebuffer function (self) -> Any X.grabFramebuffer() -> PythonQt.QtGui.QImage
grabGesture function (self, type: Any, arg1: flags) -> Any X.grabGesture(type, flags) (shared captured text)
grabKeyboard function (self) -> Any (shared captured text)
grabMouse function (self, arg__1: Any) -> Any (shared captured text)
grabShortcut function (self, key: Any, context: Any) -> int X.grabShortcut(key, context) -> int (shared captured text)
graphicsEffect function (self) -> Any X.graphicsEffect() -> PythonQt.QtGui.QGraphicsEffect (shared captured text)
graphicsProxyWidget function (self) -> Any X.graphicsProxyWidget() -> PythonQt.QtGui.QGraphicsProxyWidget (shared captured text)
hasFocus function (self) -> bool X.hasFocus() -> bool (shared captured text)
hasHeightForWidth function (self) -> bool X.hasHeightForWidth() -> bool (shared captured text)
hasMouseTracking function (self) -> bool X.hasMouseTracking() -> bool (shared captured text)
height attribute Any (shared captured text)
heightForWidth function (self, arg__1: Any) -> int X.heightForWidth(arg__1) -> int (shared captured text)
heightMM function (self) -> int X.heightMM() -> int (shared captured text)
help function (self, *args: Any, **kwargs: Any) -> Any Shows the help of available methods for this class (shared captured text)
hide function (self) -> Any (shared captured text)
hideEvent function (self, event: Any) -> Any (shared captured text)
inherits function (self, *args: Any, **kwargs: Any) -> Any Returns if the class inherits or is of given type name (shared captured text)
initPainter function (self, painter: Any) -> Any (shared captured text)
initializeGL function (self) -> None This virtual function is called once before the first call to [paintGL](https://doc.qt.io/archives/qt-5.15/qopenglwidget.html#paintGL)() or…
inputMethodEvent function (self, arg__1: Any) -> Any (shared captured text)
inputMethodHints attribute Any (shared captured text)
inputMethodQuery function (self, arg__1: Any) -> Any X.inputMethodQuery(arg__1) -> object (shared captured text)
insertAction function (self, before: Any, action: Any) -> Any X.insertAction(before, action) (shared captured text)
insertActions function (self, before: Any, actions: Any) -> Any X.insertActions(before, actions) (shared captured text)
installEventFilter function (self, filterObj: Any) -> Any (shared captured text)
isActiveWindow attribute Any (shared captured text)
isAncestorOf function (self, child: Any) -> bool X.isAncestorOf(child) -> bool (shared captured text)
isEnabled function (self) -> bool X.isEnabled() -> bool (shared captured text)
isEnabledTo function (self, arg__1: Any) -> bool X.isEnabledTo(arg__1) -> bool (shared captured text)
isFullScreen function (self) -> bool X.isFullScreen() -> bool (shared captured text)
isHidden function (self) -> bool X.isHidden() -> bool (shared captured text)
isLeftToRight function (self) -> bool X.isLeftToRight() -> bool (shared captured text)
isMaximized function (self) -> bool X.isMaximized() -> bool (shared captured text)
isMinimized function (self) -> bool X.isMinimized() -> bool (shared captured text)
isModal function (self) -> bool X.isModal() -> bool (shared captured text)
isRightToLeft function (self) -> bool X.isRightToLeft() -> bool (shared captured text)
isSignalConnected function (self, signal: Any) -> bool X.isSignalConnected(signal) -> bool (shared captured text)
isValid function (self) -> bool X.isValid() -> bool
isVisible function (self) -> bool X.isVisible() -> bool (shared captured text)
isVisibleTo function (self, arg__1: Any) -> bool X.isVisibleTo(arg__1) -> bool (shared captured text)
isWidgetType function (self) -> bool X.isWidgetType() -> bool (shared captured text)
isWindow function (self) -> bool X.isWindow() -> bool (shared captured text)
isWindowModified function (self) -> bool X.isWindowModified() -> bool (shared captured text)
isWindowType function (self) -> bool X.isWindowType() -> bool (shared captured text)
keyPressEvent function (self, event: Any) -> Any (shared captured text)
keyReleaseEvent function (self, event: Any) -> Any (shared captured text)
keyboardGrabber function (self) -> Any X.keyboardGrabber() -> PythonQt.QtGui.QWidget (shared captured text)
killTimer function (self, id: Any) -> Any (shared captured text)
layout function (self) -> Any X.layout() -> PythonQt.QtGui.QLayout (shared captured text)
layoutDirection attribute Any (shared captured text)
leaveEvent function (self, event: Any) -> Any (shared captured text)
locale attribute QLocale (shared captured text)
logicalDpiX function (self) -> int X.logicalDpiX() -> int (shared captured text)
logicalDpiY function (self) -> int X.logicalDpiY() -> int (shared captured text)
lower function (self) -> Any (shared captured text)
makeCurrent function (self) -> None Prepares for rendering OpenGL content for this widget by making the corresponding context current and binding the framebuffer object in that context.
mapFrom function (self, arg__1: Any, arg__2: Any) -> Any X.mapFrom(arg__1, arg__2) -> PythonQt.QtCore.QPoint (shared captured text)
mapFromGlobal function (self, arg__1: Any) -> Any X.mapFromGlobal(arg__1) -> PythonQt.QtCore.QPoint (shared captured text)
mapFromParent function (self, arg__1: Any) -> Any X.mapFromParent(arg__1) -> PythonQt.QtCore.QPoint (shared captured text)
mapTo function (self, arg__1: Any, arg__2: Any) -> Any X.mapTo(arg__1, arg__2) -> PythonQt.QtCore.QPoint (shared captured text)
mapToGlobal function (self, arg__1: Any) -> Any X.mapToGlobal(arg__1) -> PythonQt.QtCore.QPoint (shared captured text)
mapToParent function (self, arg__1: Any) -> Any X.mapToParent(arg__1) -> PythonQt.QtCore.QPoint (shared captured text)
mask function (self) -> Any X.mask() -> PythonQt.QtGui.QRegion (shared captured text)
maximized attribute Any (shared captured text)
maximumHeight attribute Any (shared captured text)
maximumSize attribute QSize (shared captured text)
maximumWidth attribute Any (shared captured text)
metaObject function (self) -> Any X.metaObject() -> PythonQt.QtCore.QMetaObject (shared captured text)
metric function (self, metric: Any) -> int X.metric(metric) -> int
minimized attribute Any (shared captured text)
minimumHeight attribute Any (shared captured text)
minimumSize attribute QSize (shared captured text)
minimumSizeHint attribute QSize (shared captured text)
minimumWidth attribute Any (shared captured text)
modal attribute Any (shared captured text)
mouseDoubleClickEvent function (self, event: Any) -> Any (shared captured text)
mouseGrabber function (self) -> Any X.mouseGrabber() -> PythonQt.QtGui.QWidget (shared captured text)
mouseMoveEvent function (self, event: Any) -> Any (shared captured text)
mousePressEvent function (self, event: Any) -> Any (shared captured text)
mouseReleaseEvent function (self, event: Any) -> Any (shared captured text)
mouseTracking attribute Any (shared captured text)
move function (self, x: Any, y: Any) -> Any X.move(x, y) (shared captured text)
moveEvent function (self, event: Any) -> Any (shared captured text)
moveToThread function (self, thread: Any) -> Any (shared captured text)
nativeEvent function (self, eventType: Any, message: Any, result: Any) -> bool X.nativeEvent(eventType, message, result) -> bool (shared captured text)
nativeParentWidget function (self) -> Any X.nativeParentWidget() -> PythonQt.QtGui.QWidget (shared captured text)
nextInFocusChain function (self) -> Any X.nextInFocusChain() -> PythonQt.QtGui.QWidget (shared captured text)
normalGeometry attribute QRect (shared captured text)
objectName attribute Any (shared captured text)
objectNameChanged function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.QtGui.QOpenGLWidget.objectNameChanged; argument details are not documented.
overrideWindowFlags function (self, type: Any) -> Any (shared captured text)
overrideWindowState function (self, state: Any) -> Any (shared captured text)
paintEngine function (self) -> Any X.paintEngine() -> PythonQt.QtGui.QPaintEngine
paintEvent function (self, e: Any) -> None Reimplements: [QWidget::paintEvent](https://doc.qt.io/archives/qt-5.15/qwidget.html#paintEvent)(QPaintEvent *event).
paintGL function (self) -> None This virtual function is called whenever the widget needs to be painted.
paintingActive function (self) -> bool X.paintingActive() -> bool (shared captured text)
palette attribute QPalette (shared captured text)
parent function (self) -> Any X.parent() -> PythonQt.private.QObject (shared captured text)
parentWidget function (self) -> Any X.parentWidget() -> PythonQt.QtGui.QWidget (shared captured text)
physicalDpiX function (self) -> int X.physicalDpiX() -> int (shared captured text)
physicalDpiY function (self) -> int X.physicalDpiY() -> int (shared captured text)
pos attribute QPoint (shared captured text)
previousInFocusChain function (self) -> Any X.previousInFocusChain() -> PythonQt.QtGui.QWidget (shared captured text)
property function (self, name: Any) -> Any X.property(name) -> object (shared captured text)
raise_ function (self) -> Any Native spelling: raise; access it through getattr on the native object. (shared captured text)
rect attribute QRect (shared captured text)
redirected function (self, p: Any) -> Any X.redirected(p) -> PythonQt.QtGui.QPaintDevice
releaseKeyboard function (self) -> Any (shared captured text)
releaseMouse function (self) -> Any (shared captured text)
releaseShortcut function (self, id: Any) -> Any (shared captured text)
removeAction function (self, action: Any) -> Any (shared captured text)
removeEventFilter function (self, obj: Any) -> Any (shared captured text)
render function (self, target: Any, targetOffset: Any, sourceRegion: Any, renderFlags: Any) -> Any X.render(target, targetOffset, sourceRegion, renderFlags) (shared captured text)
repaint function (self, x: Any, y: Any, w: Any, h: Any) -> Any X.repaint(x, y, w, h) (shared captured text)
resize function (self, w: Any, h: Any) -> Any X.resize(w, h) (shared captured text)
resizeEvent function (self, e: Any) -> None Reimplements: [QWidget::resizeEvent](https://doc.qt.io/archives/qt-5.15/qwidget.html#resizeEvent)(QResizeEvent *event).
resizeGL function (self, w: int, h: int) -> None X.resizeGL(w, h)
resized function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.QtGui.QOpenGLWidget.resized; argument details are not documented.
restoreGeometry function (self, geometry: Any) -> bool X.restoreGeometry(geometry) -> bool (shared captured text)
saveGeometry function (self) -> Any X.saveGeometry() -> PythonQt.QtCore.QByteArray (shared captured text)
scroll function (self, dx: Any, dy: Any, arg__3: Any) -> Any X.scroll(dx, dy, arg__3) (shared captured text)
sender function (self) -> Any X.sender() -> PythonQt.private.QObject (shared captured text)
senderSignalIndex function (self) -> int X.senderSignalIndex() -> int (shared captured text)
setAcceptDrops function (self, on: Any) -> Any (shared captured text)
setAccessibleDescription function (self, description: Any) -> Any (shared captured text)
setAccessibleName function (self, name: Any) -> Any (shared captured text)
setAttribute function (self, arg__1: Any, on: Any) -> Any X.setAttribute(arg__1, on) (shared captured text)
setAutoFillBackground function (self, enabled: Any) -> Any (shared captured text)
setBackgroundRole function (self, arg__1: Any) -> Any (shared captured text)
setBaseSize function (self, basew: Any, baseh: Any) -> Any X.setBaseSize(basew, baseh) (shared captured text)
setContentsMargins function (self, left: Any, top: Any, right: Any, bottom: Any) -> Any X.setContentsMargins(left, top, right, bottom) (shared captured text)
setContextMenuPolicy function (self, policy: Any) -> Any (shared captured text)
setCursor function (self, arg__1: Any) -> Any (shared captured text)
setDisabled function (self, a: Any) -> Any (shared captured text)
setEnabled function (self, a: Any) -> Any (shared captured text)
setFixedHeight function (self, h: Any) -> Any (shared captured text)
setFixedSize function (self, w: Any, h: Any) -> Any X.setFixedSize(w, h) (shared captured text)
setFixedWidth function (self, w: Any) -> Any (shared captured text)
setFocus function (self, reason: Any) -> Any (shared captured text)
setFocusPolicy function (self, policy: Any) -> Any (shared captured text)
setFocusProxy function (self, arg__1: Any) -> Any (shared captured text)
setFont function (self, arg__1: Any) -> Any (shared captured text)
setForegroundRole function (self, arg__1: Any) -> Any (shared captured text)
setFormat function (self, format: Any) -> None Sets the requested surface format.
setGeometry function (self, x: Any, y: Any, w: Any, h: Any) -> Any X.setGeometry(x, y, w, h) (shared captured text)
setGraphicsEffect function (self, effect: Any) -> Any (shared captured text)
setHidden function (self, hidden: Any) -> Any (shared captured text)
setInputMethodHints function (self, hints: Any) -> Any (shared captured text)
setLayout function (self, arg__1: Any) -> Any (shared captured text)
setLayoutDirection function (self, direction: Any) -> Any (shared captured text)
setLocale function (self, locale: Any) -> Any (shared captured text)
setMask function (self, arg__1: Any) -> Any (shared captured text)
setMaximumHeight function (self, maxh: Any) -> Any (shared captured text)
setMaximumSize function (self, maxw: Any, maxh: Any) -> Any X.setMaximumSize(maxw, maxh) (shared captured text)
setMaximumWidth function (self, maxw: Any) -> Any (shared captured text)
setMinimumHeight function (self, minh: Any) -> Any (shared captured text)
setMinimumSize function (self, minw: Any, minh: Any) -> Any X.setMinimumSize(minw, minh) (shared captured text)
setMinimumWidth function (self, minw: Any) -> Any (shared captured text)
setMouseTracking function (self, enable: Any) -> Any (shared captured text)
setObjectName function (self, name: Any) -> Any (shared captured text)
setPalette function (self, arg__1: Any) -> Any (shared captured text)
setParent function (self, parent: Any, f: Any) -> Any X.setParent(parent, f) (shared captured text)
setProperty function (self, name: Any, value: Any) -> bool X.setProperty(name, value) -> bool (shared captured text)
setShortcutAutoRepeat function (self, id: Any, enable: Any) -> Any X.setShortcutAutoRepeat(id, enable) (shared captured text)
setShortcutEnabled function (self, id: Any, enable: Any) -> Any X.setShortcutEnabled(id, enable) (shared captured text)
setSizeIncrement function (self, w: Any, h: Any) -> Any X.setSizeIncrement(w, h) (shared captured text)
setSizePolicy function (self, horizontal: Any, vertical: Any) -> Any X.setSizePolicy(horizontal, vertical) (shared captured text)
setStatusTip function (self, arg__1: Any) -> Any (shared captured text)
setStyle function (self, arg__1: Any) -> Any (shared captured text)
setStyleSheet function (self, styleSheet: Any) -> Any (shared captured text)
setTabOrder function (self, arg__1: Any, arg__2: Any) -> Any X.setTabOrder(arg__1, arg__2) (shared captured text)
setToolTip function (self, arg__1: Any) -> Any (shared captured text)
setToolTipDuration function (self, msec: Any) -> Any (shared captured text)
setUpdateBehavior function (self, updateBehavior: Any) -> None Sets this widget's update behavior to updateBehavior.
setUpdatesEnabled function (self, enable: Any) -> Any (shared captured text)
setVisible function (self, visible: Any) -> Any (shared captured text)
setWhatsThis function (self, arg__1: Any) -> Any (shared captured text)
setWindowFilePath function (self, filePath: Any) -> Any (shared captured text)
setWindowFlags function (self, type: Any) -> Any (shared captured text)
setWindowIcon function (self, icon: Any) -> Any (shared captured text)
setWindowIconText function (self, arg__1: Any) -> Any (shared captured text)
setWindowModality function (self, windowModality: Any) -> Any (shared captured text)
setWindowModified function (self, a: Any) -> Any (shared captured text)
setWindowOpacity function (self, level: Any) -> Any (shared captured text)
setWindowRole function (self, arg__1: Any) -> Any (shared captured text)
setWindowState function (self, state: Any) -> Any (shared captured text)
setWindowTitle function (self, a: Any) -> Any (shared captured text)
sharedPainter function (self) -> Any X.sharedPainter() -> PythonQt.QtGui.QPainter (shared captured text)
show function (self) -> Any (shared captured text)
showEvent function (self, event: Any) -> Any (shared captured text)
showFullScreen function (self) -> Any (shared captured text)
showMaximized function (self) -> Any (shared captured text)
showMinimized function (self) -> Any (shared captured text)
showNormal function (self) -> Any (shared captured text)
signalsBlocked function (self) -> bool X.signalsBlocked() -> bool (shared captured text)
size attribute QSize (shared captured text)
sizeHint attribute QSize (shared captured text)
sizeIncrement attribute QSize (shared captured text)
sizePolicy attribute QSizePolicy (shared captured text)
stackUnder function (self, arg__1: Any) -> Any (shared captured text)
startTimer function (self, interval: Any, timerType: Any) -> int X.startTimer(interval, timerType) -> int (shared captured text)
statusTip attribute Any (shared captured text)
style function (self) -> Any X.style() -> PythonQt.QtGui.QStyle (shared captured text)
styleSheet attribute Any (shared captured text)
tabletEvent function (self, event: Any) -> Any (shared captured text)
tabletTracking attribute Any (shared captured text)
testAttribute function (self, arg__1: Any) -> bool X.testAttribute(arg__1) -> bool (shared captured text)
thread function (self) -> Any (shared captured text)
timerEvent function (self, event: Any) -> Any (shared captured text)
toolTip attribute Any (shared captured text)
toolTipDuration attribute Any (shared captured text)
tr function (self, text: Any, ambig: Any, n: Any) -> str X.tr(text, ambig, n) -> str (shared captured text)
underMouse function (self) -> bool X.underMouse() -> bool (shared captured text)
ungrabGesture function (self, type: Any) -> Any (shared captured text)
unsetCursor function (self) -> Any (shared captured text)
unsetLayoutDirection function (self) -> Any (shared captured text)
unsetLocale function (self) -> Any (shared captured text)
update function (self, x: Any, y: Any, w: Any, h: Any) -> Any X.update(x, y, w, h) (shared captured text)
updateBehavior function (self) -> Any Returns the update behavior of the widget.
updateGeometry function (self) -> Any (shared captured text)
updatesEnabled attribute Any (shared captured text)
visible attribute Any (shared captured text)
visibleRegion function (self) -> Any X.visibleRegion() -> PythonQt.QtGui.QRegion (shared captured text)
whatsThis attribute Any (shared captured text)
wheelEvent function (self, event: Any) -> Any (shared captured text)
width attribute Any (shared captured text)
widthMM function (self) -> int X.widthMM() -> int (shared captured text)
winId function (self) -> int X.winId() -> int (shared captured text)
window function (self) -> Any X.window() -> PythonQt.QtGui.QWidget (shared captured text)
windowFilePath attribute Any (shared captured text)
windowFlags function (self) -> Any (shared captured text)
windowHandle function (self) -> Any X.windowHandle() -> PythonQt.QtGui.QWindow (shared captured text)
windowIcon attribute QIcon (shared captured text)
windowIconChanged function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.QtGui.QOpenGLWidget.windowIconChanged; argument details are not documented.
windowIconText attribute Any (shared captured text)
windowIconTextChanged function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.QtGui.QOpenGLWidget.windowIconTextChanged; argument details are not documented.
windowModality attribute Any (shared captured text)
windowModified attribute Any (shared captured text)
windowOpacity attribute Any (shared captured text)
windowRole function (self) -> str X.windowRole() -> str (shared captured text)
windowState function (self) -> Any (shared captured text)
windowTitle attribute Any (shared captured text)
windowTitleChanged function (self, *args: Any, **kwargs: Any) -> Any Native PythonQt.QtGui.QOpenGLWidget.windowTitleChanged; argument details are not documented.
windowType function (self) -> Any (shared captured text)
x attribute Any (shared captured text)
y attribute Any (shared captured text)