Please nominate your Qt Champions for 2021! https://forum.qt.io/topic/132134/looking-for-the-2021-qt-champions

Qt5: mixing QtQuick/QML and QGraphicsItem (working with scenegraph on C++ side)



  • I have a Qt 4.8 application in which I'm currently mixing QtQuick with the QGraphicsItem framework.
    Precisely, I am having a QGraphicsScene inside a QGraphicsView and I have a small framework which allows me to add views to the scene. The views can be written either in plain QML (instantiated in C++ via QDeclarativeComponent and friends) or they are implemented directly using the QGraphicsItem derived classes.

    Qt5 implements QML items within the new scenegraph framework. If I understood the sources correctly the new QtQuick 2 items are not implemented as QDeclarativeItems but derive from QQuickItem instead.

    Is there still a way to mix QGraphicItems with the new QML items? If not, is it at least possible to control the QML-scenegraph from the C++ side? I'm planning a somewhat larger application and would like to manage the creation and presentation of views on the C++ side, e.g. by using classes named QmlViewFactory, QmlViewSceneManager, and simliar patterns.

    Thanks in advance.


Log in to reply