QQmlListProperty<> cannot be assign with another QQmlListProperty<> or a QList<>, but it does support javascript Array. I myself made a simple function to convert:
function adaptQQLP(list_obj) { return [].concat(list_obj); } It does iterate on it and create a javascript array which is enough MyQmlObj { myQQmlListProperty: adaptQQLP(myOtherId_.itsOwnQQmlListProperty) } This is a workaround the QQmlListProperty madness. This and the clear and push everything back for any modification where performance goes down the toilette. Tumb rules avoid those QQmlListProperty as much as possible your software performance will thank you. Jerome On Tue, Jul 26, 2016 at 11:23 AM, Jason H <jh...@gmx.com> wrote: > > I'd just write my proxy model in C++ and be done with it. > > > > André > > > > > > Op 26/07/2016 om 15:46 schreef Jason H: > > > I want to have groups corresponding to the equivalent of 'SELECT > DISTINCT x' query. Then I want each item assigned to a group of it's value > of x. For example: > > > 'SELECT DISTINCT x' -> ['a', 'b', 'c'] > > > 'SELECT x,y' -> [ ['a', '1'], ['a','2'], ['b','3'], ['c', '4'], > ['c','11'] ] > > > > > > Then I have 3 groups: a has 2, b has 1, c as 2, then I want to set > filerOnGroup to one of the groups. Is there a way to do this? > > DelegateModel.groups is a list<DelegateModelGroup>, but there seems to be > no way to add a group to it. > The DelegateModel.groups property resolves (in QtCreator) to an instance > of a DelegateModelGroup (having .addGroup()) which applies to adding groups > to *model items* and not groups it self. > > When I console.log groups, I get: > {"0":{"objectName":"","count":8,"name":"items","includeByDefault":true},"1":{"objectName":"","count":0,"name":"persistedItems","includeByDefault":false}} > > So I try: > var recipientGroup = recipientComponent.createObject(recipientComponent, > {includeByDefault: false, name: number}) // (works) > groups[groups.length] = recipientGroup; but it doesn't take. > Of I try to assign them all at once: groups = recipientModelGroups; > I get: Error: Cannot assign QList<QObject*> to > QQmlListProperty<QQmlDelegateModelGroup> > _______________________________________________ > Interest mailing list > Interest@qt-project.org > http://lists.qt-project.org/mailman/listinfo/interest >
_______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest