[Interest] 5.9 Wish: Reduce the QML model switching pain

Jason H jhihn at gmx.com
Wed Jan 4 02:54:32 CET 2017


For C++ models, Qt uses .count. For JS models, it uses .length. When you find yourself in the unenviable position of having to provide a C++ model where a JS one would have sufficed, it's painful to have to change all the model.length-s to model.count-s.

That's the "easy part".

But the real magic would be if we could also eliminate the setProperty(index, property, value) pain. The desire is to 
be able to use:
modelItems[i].property = 7

directly, instead of:
modelItems.setProperty(i, "property", 7)

The rest of JS land is moving to observables. It would be nice when setting a JS object to a model that transparently wraps it in some kind of QObservable that would take care of translating direct accesses to the proper model updates.


Also, in a similar vein, support for:
- for (var i of x) (ES2015)






More information about the Interest mailing list