Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

How to reload the repeater's data model in QML?



  • I've a QML with Repeater which uses QList(QObjects) as its data model. On a button click, an attribute QLIST X object is updated. As the underlying data model property value is updated, I wish to have the updated property value reflected in my QML.

    I tried emiting a SIGNAL from cpp when the property value is changed, However, I don't get to see the changes reflected in QML UI i.e. the repeater is not sensing the UPDATED QList.

    @
    Repeater {
    id: repeaterSlot
    model: dataSupplier
    Image
    {
    id: imgSlot
    width: 75; height: 75
    source: "images/"+modelData.imageName + ".png";
    }
    }
    @

    In the above scenario, the imageName of underlying QObject is updated on click of a button. I want to Repeater to fetch the recently updated QList(QOBjects), refresh the image to show latest picture.


Log in to reply