⚠️ Forum Maintenance: Feb 6th, 8am - 14pm (UTC+2)

Embedding a external Qt widget application in QML window.

  • Hi

    I am using Qt 5.3 in ubuntu. I have a Qt Widget application. This application has to be embedded in my QML application. I tried to use QWidget::createwindowcontainer() for doing this. But the embedding window is coming as a seperate window.

    Can you suggest whether there is any way I can do this correctly so that the external application opens inside my QML window.


  • Qt Champions 2017

    Welcome the forum. You can embed the QML Window into QWidget app. That is what createWinContainer is meant for. Hope you are setting the parent widget when you are creating. Hope you are not showing the new window separately. If you can post sample source, it will help as well.

  • Thanks for your reply.

    But I have to embed my Qt Widget app into my QML application.

    How can I do that?

  • Qt Champions 2017

    You can't embed Qt Widget into QML in 5.x. You can do other way round only. If you are pre Qt 5.x you can make it happen.

  • Doesn't embedding QML controls (say Toolbar) inside a QWidget (say QMainWindow) mean that you lose the benefit of QML that automatically places the toolbar in the appropriate place (say at the top for Android, at the bottom for iOS)? (You get that benefit if you use a QML Application Window control.) Because you are responsible for laying out the QWidget container of the QML Toolbar control. I suppose it is no big deal.

    More specific example of "you can't embed QWidget in QML in Qt5": a QML ApplicationWindow.contentItem can only be a QQuickWindow or subclass.

Log in to reply