[Interest] Embedding QWindow

rap rap at dlc.fi
Tue Aug 5 13:40:15 CEST 2014

Thanks, this discussion has been really useful, I haven't found anything written giving the larger picture, just nuts and bolts 

Regarding the idea of using MDI and QWindow for child wnds seems to stumble on the fact that QMdiSubWindow class is a QWidget based 
class too. There seems to be no escape from using QWidget::createWindowContainer() at the moment, even for MDI child wnds.

- Risto

> From: Agocs Laszlo
> Sent: Tuesday, August 05, 2014 2:21 PM

> 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.

> Best regards,
> Laszlo

> 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).
> Cheers,
>  Oliver

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 mailing list