Hello,
I am writing an application that fetches few items from the symbian database and adds them to a list view that is shown using QML.
I am using listview in my qml file and i have named the model to that list view as "listModel"
Hence, I am initialising it in C++ code like this:
QDeclarativeContext *context = view->rootContext();
context->setContextProperty("listModel",QVariant::fromValu e(mItemsList));
where, mItemsList is a QList of items.
Things are working fine till now. Now, when I get a notification that new item has been added, I want to update the model.
Right now, am again calling:
context->setContextProperty("listModel",QVariant::fromValu e(mAlarmsList));
This will again set the new model to the list view. This is working fine.
But, I would like to know, if this is the only way to update the model.
Is there a way to append/insert just newly added item to the already existing model in my C++ code?
One more thing -> As you all might know, listview has a property called "currentIndex".
If I want to manipulate this property of the list view that is defined in qml, how can I do that?
Regards
Chiru
Bookmarks