Use scene graph (qt quick 2.0) in c++ without qml?
-
Hi,
I was wondering how I would start to implement a c++ application that is using an OpenGL scene graph (qt quick 2.0). I have an application based onQGraphicsView/Scene for the moment. It basically creates QGraphicsItems (QGraphicsTextItem, QGraphicsVideoItem, my own QGraphicsItems...) on the fly in this scene and animates them (moving or update/paint of the item itself).
Can I do the same thing using qt quick 2.0 but without using qml and just use the backend of qml in c++ to get the performing opengl backend? I was looking at QtQuickCanvas and QtQuickItem but there are no classes for example to have a rectangle in the scene but there are rectangles available in qml. Are these qml items not usable in a pure c++ application? Can anyone point me to a simple example of for example drawing some text or a rectangle in a scene graph without using qml, only c++?
Any guidance for converting a QGraphicsScene/View application to QtQuick 2.0 is welcome!
-
Many QtQuick classes are private, where only QML interface is available. But, I think you could do it in 2 ways:
Through QML-C++ bindings, generate QML components instead of QGraphicsItem's
Create your own QML elements with custom painting code
But it would take some serious effort to do this, probably. I would suggest to go with QML. Or, you can take a look at how Qt devs paint SceneGraph objects to get the idea on how it should be done.