Register QTreeView To Qml using QGraphicsProxyWidget (QtQuick 2.0)
-
I am trying to embed QTreeView into QML using QGraphicsProxyWidget. When I run my programme, there is a error hint that tells me my registered item is a QtQuick 1.0 item and it cannot be used in QtQuick 2.0。Does it mean the subclass of QGraphicsProxyWidget can only be registered to a QtQuick 1.0 component? Or is there any misusing in my programme? Thank you for your help!
-
No, I'm afraid that is exactly what it means. QGraphicsProxyWidget is a QGraphicsItem and not a QQuickItem. Since QtQuick 2 is not built on top of QGraphicsView like QtQuick 1 was, it is no longer possible to add widgets this way.
One possible solution would be to port QTreeView into a QQuickPaintedItem yourself. The other option you have is to embed QtQuick 2 into a widget application, which will be supported in 5.1.