PDA

View Full Version : QML ListView with "normal" ItemModel



Raven24
26th January 2010, 21:57
Hello!
I'd like to use QML to display my data, which it does perfectly!
Now it would be nice if I could edit it, too.

Therefore I wrote a subclass to QAbstractListModel, which implements the methods rowCount, columnCount, data, setData and flags. The flags method returns Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsEditable. Upon creation the role names are set.
Thus, to my understanding, I should be able to access the data via QML by setContextProperty of my QmlView context. It can now be displayed in a ListView.

Now the problem:
If I bind the "name" property of my model to a TextInput in QML I am perfectly able to see the text, but not to edit it. I get the feeling I am missing something...

Any help gladly appreciated!