Qt World Summit: Submit your Presentation

Embed qwidget in QML.

  • Hello!

    I have my own widget, where I reimplemented paintEvent, mouseMoveEvent and etc, "here":http://qt-project.org/forums/viewthread/7893 is the answer to my question for Qt 4.7, but what is the way to embed qwidget in QtQuick 2 (Qt 5.1)?


  • There is no official way to embed QWidget in QML right now. The best way is to port the widget to a QQuickPaintedItem or use Qt Quick Controls to replace widget functionality in your application.

    There is however a way to embed Qt Quick inside a widget by means of QWidget::createWindowContainer

  • Hello, Jens. Reading docs I've found that we can reimplement updatePaintNode function too. Isn't that approach is better?

  • That depends on your use case. If you are showing pure 3d geometry then yes, but most normal widgets are a lot easier to port by using QQuickPaintedItem.

Log in to reply