On Jan 10, 2013, at 5:46 PM, Alberto Mardegan <ma...@users.sourceforge.net> wrote:
> Hi all! > I'd like to make C++ models more usable from QML; in the net there > are several blog posts illustrating how to achieve that, but IMHO it > would be better if at least some of these handy features were in > QAbstractListModel itself: > > - "count" property > - "get(index)" invocable method, returning a QVariantMap mapping all the > roles to their data for the specified index +1 from me. That would clean up a lot of the ugly special casing we have to deal with whenever models are provided to components. > Also, though not very often requested, we could add: > - "remove(index)" which just calls QAbstractItemModel::removeRow() > - "QList<QVariant> items(const QString &role)", which returns the data > for the role "role" for all items. > > The implementation for the above is fairly trivial, so I wonder if > there's some other reasons why it hasn't been done or if it's just that > no one did and a patch is welcome. I would suspect it the latter and we just assumed there was a philosophy behind it. Another possibly low hanging fruit is to add some convenience for sorting models. But the model implementation differences make straight forward use of QSortFilterProxyModel problematic. Jens _______________________________________________ Development mailing list Development@qt-project.org http://lists.qt-project.org/mailman/listinfo/development