PDA

View Full Version : How to bind the listview using listelement with dynamic values?



Mathan
3rd October 2016, 18:49
Hi all,

I want to bind the listelement from .cpp file. The code below is static. I have an .xml file with itemTitle,ImageURL,itemId and I can read from xml. Now I want to pass the value from .cpp to .qml

Query:
1.What is the return type has to mention in .cpp file to bind with list element?

How to bind the return type in ListElement component in .qml file.
If possible code snippet please.

Code Snippet:

ListElement { itemTitle: "Housing with Mortgages"; imageUrl: "qrc:/Samples/Maps/OpenExistingMap/Housing.png"; itemId: "2d6fa24b357d427f9c737774e7b0f977"}
ListElement { itemTitle: "USA Tapestry Segmentation"; imageUrl: "qrc:/Samples/Maps/OpenExistingMap/Tapestry.png"; itemId: "01f052c8995e4b9e889d73c3e210ebe3"}
ListElement { itemTitle: "Geology of United States"; imageUrl: "qrc:/Samples/Maps/OpenExistingMap/geology.jpg"; itemId: "74a8f6645ab44c4f82d537f1aa0e375d"}

Thanks in advance.

anda_skoa
6th October 2016, 17:20
You'll have to add some more context, there is no C++ code in your posting.

Cheers,
_