4

I have a ListModel like the following:

ListModel {
  id: liveFeedModel

  ListElement {
    modelSrc: [
        ListElement { src: "../img/pano.jpg" },
        ListElement { src: "../img/pano1.jpg" },
        ListElement { src: "../img/pano2.jpg" },
        ListElement { src: "../img/pano3.jpg" }
    ]
    name: "Cookies"
    temp: "456 °C"
    time: "--:--"
  }

  ListElement {
    modelSrc: [
        ListElement { src: "../img/pano2.jpg" }
    ]
    name: "Sourdough Roll"
    temp: "123 °F"
    time: "--:--"
  }
}

And I would like to set the value of the nested ListElements within modelSrc.

I am looking for something similar to:

liveFeedModel.get(0).modelSrc.get(2).src

except with set, setProperty, or something along those lines, instead of get

Thanks in advance

1 Answer 1

2

use:

myListView.model.get(0).modelSrc.setProperty(0, "src", "../img/pano2.jpg");

simple as that!

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.