Details
-
Suggestion
-
Resolution: Done
-
P2: Important
-
4.7.0, 5.0.0
-
None
-
Qt (kinetic-declarative) - git from 3. feb. 2010
Ubuntu 9.10
Description
When a C++ data model (like a derived class of QAbstractListModel) is exposed to QML via a context property, and that model is editable, the different properties of an item (that are accessible to the delegate by model.someproperty) should be writeable, too.
I am currently unable to find a simple method to edit that kind of data except emitting a signal from the root component and catching that in C++ and then setting the data there.
For example
//assigning someModel an editable derived class of QAbstractListModel contx->setContextProperty("someModel", someModel); // in QML ListView { id: someListView delegate: someDelegate model: someModel } Component { id: someDelegate ... function saveData() { model.someproperty = someNewValue; model.anotherproperty = anotherNewValue; } ... }
I hope it's clear what I mean...
If thats not the way to go, please update the documentation with the "right" method.