Is it possible to integrate a QWidget into QML/QtQuick 2.0.
The problem I'm facing is the following:
- I have a Qt 5.5 project where I use QML/QtQuick 2.0 for the GUI.
- I want to reuse/integrate a QWidget from another project that does not use qml files.
I got to the point where I can show the widget in a separate window. However I need it to be part of the main window, which is qml. I also have trouble getting events back from the widget.
On blogs I read that it is not possible to integrate a QWidget into QML with QtQuick 2.0.
Can either someone verify this statement or show a solution to integrate a QWidget into QML/QtQuick 2.0.
@RichardD No. Because pure QML doesnot have any functionality which will understand
It's actually the other way. You can integrate QML in
For eg: have a look at QQuickWidget and
QWidget'screateWindowContainer. The recommended one is
@p3c0 Thanks for the quick response!
I have seen that the other way around is possible, but unfortunately that is not the problem I'm dealing with.
I found some examples but they are dated, on a previous version of Qt or use QtQuick 1.0:
The QGraphicsProxyWidget method looks very promising to me.
So could you state that with QtQuick 1.0 it was possible and with QtQuick 2.0 it is no longer possible?
If the above statement is true, I wonder why this is no longer possible. I can imagine, that a lot of developers have created custom widgets that they would like to use in new qml based applications. Are the concept that different that there is no workaround to deal with this?
QtQuick 2.0is completely different from
QtQuick 1.0backend was implemented with Qt's Graphics Framework while
QtQuick 2.0is based on Scene Graph to take advantage of OpenGL.
QtQuick 1.0was based on Graphics Framework the API's like
QGraphicsProxyWidgetcould be used out of the box in it. But there is no such functionality in
Some references here:
You will need to port some of the functionality to
QtQuick 2.0for eg. using