Important: Please read the Qt Code of Conduct -

Instantiation of another QAbstractListModel derived class

  • I have created C++ class which is holding information for a QML interface. The QML interface has basically a couple of panes for interaction. Now I like to add on one of the panes a variable table fed by a class derived from QAbstractListModel.

    I have mastered the fixed information display through model and repeater. The derived class has been registered by qmlRegisterType. However, the instance of that class needs to be updated through C++, but I have no real understanding where the instance is located.

    How can I instanciate the new C++ class within my main class and make it accessible in the qml file?

  • Lifetime Qt Champion


    One way to achieve that is through context properties.

  • @SGaist

    Thanks for pointing into that direction. It does work.

Log in to reply