Search code examples
c++qtqmlhwnd

Qt, c++ QML and HWND


I need to use a DLL -library that requests a window handle (HWND) to draw it self on a form. I don't want it to ocupy the whole main form but be displayed in for example a sub widget's area.
Now this is no problem using windows forms. But Can I do it using Qt or even with a Qt QML based ui?

Let's say I have a mainwindow and want this library to draw itself on a QML rectangle inside the main window. can i provide the library with a valid handle in any way?
this post is related but does not solve anything : DevNet HWND in QML


Solution

  • Yes it is possible, I did it some days ago in a project.

    You can retrieve the win ID of any widget, thanks to : QWidget::winId.

    I didn't try with QML, but as QML is drawn in a QGraphicsView( which is a QWidget ), maybe that can work.