How to show a widget by WId in Qt Quick 2 (Qt 5.0.1)
I'm looking for a solution to show the contents of a dll that need a HWND (winId) to do it.
Somebody already did implement it? I see from documentation that before it was possible but in 5.x is not,
because it is not possible to mix QWidget with QML, is it?
Thanks a lot for your help.
Mixing QWidget with QML is available again in Qt 5.1, using QWidget::createWindowContainer
You can check out the code from git.
There is something I cannot get: in that way the application is mainly a QtQuick app or a QWidget App? Which are the implication when I want to port it to Android or iOS?
The issue comes because I have a dll that can show by HWND the contents of a proprietary file format...
I need to use Qt Quick because in few months I like to be ready to move to Android and iOS, waiting for the port to these platform of the viewer in the dll.
Kindly can you give me some advice?
Thanks a lot.
Sorry, I think you solved my problem! Thanks!
In the end I got it! :-)
As far as I know "QWidget::createWindowContainer" only solves inserting "QWindow"-based views (Quick2, Qt5-GUI-OpenGL-View, Qt3D-view,...) into QWidget-GUI/-Layout
So, it wont help you getting a native (winId) view into a Quick2-view
I'm not aware that there is something to support the other direction, but I also don't know all the related changes ...
btw. I'm not even sure that there is a equivalent to HWND on Android/iOS, maybe someone knows more about that topic?
I hope to have time to compile Qt 5.1 from git... it's my first time after last time I did years compiling kde 3...
After compiling if I'm still "working", I will test the possibility to mix QML/QWidget and try to use the winid from some of the QWidget: I promise I will post about the results, to share and to try to have a clear idea about how things work.
About iOS/Android I will not test it in a few weeks, because I like to know if I could, but right now
I don't need to dev on them.
In the way of QWidget::createWindowContainer, I think you can suppose the application is mainly a QWidget App, because the QQuickView is 'contained' in a QWidget.
And is this you are expecting for?
"The project provides a set of classes that allow using Qt and MFC/Win32 windows in the same application. User interface elements developed with Qt can be embedded into an existing MFC or Win32 based user interface, and existing custom controls developed with MFC or Win32 can be integrated into Qt widgets"
e.g. You can encapsulate your winId into a QWinHost.
Blogs about porting Qt to Android and IOS:
everything works fine in 5.1! Thanks everybody.
If somebody need help please let me know...