Search code examples
c++qtqwidgetqt5

How to put QWindow into QWidget's layout (Qt5)


I want to insert QQuickView to my old qt4 application in some widget layout. How to mix QWidget and QWindow in a single application?

Are there any examples?


Solution

  • This has been fixed in Qt 5.1. Citing [1]

    To remedy this problem, Qt 5.1 introduces the function QWidget::createWindowContainer(). A function that creates a QWidget wrapper for an existing QWindow, allowing it to live inside a QWidget-based application. Using QQuickView or QOpenGLContext together with widgets is now possible.

    [1] https://www.qt.io/blog/2013/02/19/introducing-qwidgetcreatewindowcontainer