Hi
I'm creating qt c++ application with Qml GUI. In qml I have object with ListView to display in row object's properties. In header I have declared meta type:
Qt Code:
  1. Q_DECLARE_METATYPE(QList<QObject*>)
To copy to clipboard, switch view to plain text mode 
QList<QObject*> is being passed to Qml ListView model as slot parameter. User is able to change NewPrice value.
Qt Code:
  1. ...
  2. function setPriceDetails(model)
  3. {
  4. viewPriceDetails.myModel = model
  5. }
  6. ...
  7. ListView {
  8. id: viewPriceDetails
  9. onModelChanged: {
  10. parent.height = viewCenyDetails.height + 130
  11. }
  12. model: myModel
  13. delegate: Row {
  14. Text { width: 10 }
  15. Text { text: model.modelData.ItemNo; width: 10; }
  16. Text { text: model.modelData.Description; width: 80; }
  17. Text { text: model.modelData.ActualPrice; width: 80; }
  18. MyTextInput {
  19. text: model.modelData.NewPrice
  20.  
  21. onTextChanged: model.modelData.NewPrice= text
  22. }
  23. }
  24. }
  25. ...
  26. QList<QObject*> dataList;
  27. while(queryCenaPaliw.next()){
  28. dataList.append(new ActualPrice(queryCenaPaliw.value(queryCenaPaliw.record().indexOf("ItemNo")).toString(),
  29. queryCenaPaliw.value(queryCenaPaliw.record().indexOf("Description")).toString(),
  30. queryCenaPaliw.value(queryCenaPaliw.record().indexOf("ActualPrice")).toString()));
  31. }
  32.  
  33. emit DB_AktualneCenyPaliw(QVariant::fromValue(dataList));
To copy to clipboard, switch view to plain text mode 
On button click ListView model (myModel) is being send as signal parameter to c++ object
Qt Code:
  1. signal updatePrices(variant model)
  2.  
  3. ...MenuButton {
  4. id: btnUpdate
  5. text: "Update"
  6. height: 46
  7.  
  8. onButtonClicked: {
  9. root.updatePrices(root.myModel)
  10. }
  11. }
  12. ...
To copy to clipboard, switch view to plain text mode 

Now question:
How to in c++ work with this model? I would like to use it to update my db data. How to access data in model?