I’m finding a way to add/remove item from a ListView;
In my C++ file, I’ve created a model using QList<QObject *> and setContextProperty(); all went ok and it works.
was enought, but… a beautiful:
myListObject.model.append’ [undefined] is not a function.
was shown to me even myListObject and model are both valid!!
I’ve thought that happen because QList<QObject*> doesn’t create a real ListModel (with all function like append, insert and so on…)
Is there someone that know how to resolve this?!?
For those who can be interested in that, I’ve resolved, but not in a elegant way!
But important, you cannot pass from within C++ to qml a flat QList<QObject*> because itsn’t supported well, instead you need to pass the QList thru setContextProperty of QDecalarativeContext to use in qml