[Interest] Embedding QWindow
Laszlo.Agocs at digia.com
Tue Aug 5 13:21:35 CEST 2014
There is a QWindow under the hood for each top-level widget, but it is not done via inheritance. The QWindow and QWidget hierarchies are distinct.
The description from Oliver covers the situation pretty well. One thing worth noting in addition is that using QWindow for rendering OpenGL (or raster, for that matter) stuff without relying on widgets or Qt Quick is a perfectly valid use case. Applications that render everything on their own are better off with QWindow than QGLWidget (or QOpenGLWidget) if all they need is a window they can render to.
From: interest-bounces+laszlo.agocs=digia.com at qt-project.org [interest-bounces+laszlo.agocs=digia.com at qt-project.org] on behalf of rap [rap at dlc.fi]
Sent: Tuesday, August 05, 2014 12:09 PM
To: Till Oliver Knoll; Qt Project
Subject: Re: [Interest] Embedding QWindow
> From: Till Oliver Knoll
> Sent: Tuesday, August 05, 2014 11:27 AM
> But if I am not mistaken under the hood a QWindow is also used as base for e.g. a QMainWindow.
> It is just "the lowest common and most lightweight denominator" for interaction with the underlying
> "window system" (which could also simply be a framebuffer on embedded systems, if I understood this correctly).
That don't seem to be the case, QMainWindow inherits from QWidget, which probably is the reason for the need of
QWidget::createWindowContainer() when using QWindow based classes in QWidget based contexts.
> Off course the upcoming "QOpenGLWidget" (which replaces QGLWidget) would make that
> "boilerplate code" unnecessary again.
> So for /existing/ code you can still use your QGLWidget, but progressively replace all other
> "QGL" classes with their "QOpenGL" counterparts. For new code start using QOpenGL
> classes right away (including the new QWindow based OpenGL rendering).
Right, this is exactly the reason for my initial question after studying some QtGuiApplication /QWindow based samples by KDAB, also
the Qt examples in the gui subfolder. For now, if QWindow works for MDI child wnds without any user controls that would be
sufficient for me at this point, actually even better. Working in that direction now.
Interest mailing list
Interest at qt-project.org
More information about the Interest