Well, the title says it all, lets get started :-)
Proxy Models
Something that I would love to see in QML is the QSortFilterProxyModel. I guess it needs a wrapper of some sort, but being able to sort and filter – either based on a role and a regular expression, or based on a JavaScript function would make QML even more powerful.
Why is this an important feature? To me, the goal of using QML is to put all user-interface specific code in the QML-half of the equation. Adding capabilities to do sorting, and some filtering, to QML reduces the size of the C++ run-time and further decouples the data from how the data is shown.
Lazy Models
A long time ago (pre 4.7.4) I ran into the issue that when resetting a lazy model (i.e. a model implementing canFetchMore / fetchMore) does not trigger QML to poke at canFetchMore. Very annoying, but sorted in later versions of Qt.
Namespace Clashes
In my experience, QML needs the “::” operator. Binding text to the text from a model using “text: text” does not work. Being able to say “text: ::text“, or “text: data.text” would be nice. Even though the last approach prevents the usage of components with properties named data.
I guess there already might be a way to achieve this, but I’ve not found it. If so, please tell me!
Use ‘text : model.text’
As QSFPM is a QObject, you can export it to QML like any other C++ type exported. It has some properties, but you have to create a wrapper model property.
@Stephen, yes it can be exposed, but wrapping it in a more QML-friendly interface would be helpful.
I thought qml is basically based on javascript; would ‘this’ not be the same as what c++ uses :: for?
Anyway; this post reminds me of the suggestion I made not very long ago to revamp the research project itemviews-ng and at minimum reuse the interface classes for the models. Those are much much better designed than their predecessor, the abstractitemsmodel. I know of at least 2 actively maintained forks of the project, so all it takes is someone to put the effort in and qml-ize it…
ps. with your title I was thinking more models of the human kind… ;)
We actually have a SortFilterModel in the PlasmaCore imports, and I fully agree, it’s hugely useful.
Plasma’s implementation is not a beauty queen though, so a nice one in Qt would be awesome.