I'm working on my project and I've got a problem with C++/QML data interaction. I need to make an information exchange between views: List->Project's details. Currently I'm using QAbstractModel object as a C++ model, but recently I understood that I need to use properties in my model.
E.g. string myId, which I could use to exchange data between views.
ListModel {
property string myId: ""
title:"abc"
isActive:true
...
}
I need to add such variable property string to my model from C++ code. Is there any opportunity to add a property string in C++?
I've used a StockQt example's idea how to make a "template" page, which demonstrates stock's information. But I need to fill the model from C++ and then use it as a model for the project's list and view of each project in details. In details, I have a list of projects, e.g.:
- Project A
- Project B
- Project C
and then I want to click on the project's name and look at details of this project on a different View. I see that I could make it by properties of the model, because a StockQt's example shows that it's possible, but I can't understand how to fill these properties by C++.
Details: I have a main ListView as a Master-flow menu. Then, when you click on menu item, you can see an another ListView, which shows list of projects. Then I'd like to click on the project's name and see a details page.
Help me please to resolve this problem!