On 20/02/16 13:19, Alberto Mardegan wrote:
Hi all!
Since Qt 5.5, the QItemSelectionModel class is exposed to QML as
ItemSelectionModel (in the QtQml.Models module):
http://doc.qt.io/qt-5/qml-qtqml-models-itemselectionmodel.html
Apart from having almost no documentation, this component seems to be
rather hard to use in QML: its methods work with QModelIndex (while all
the models I've ever used in QML just speak row numbers) or
QItemSelection, which I believe is not usable in QML at all (at least,
it's not documented as a QML component).
Hi Alberto,
I think you're right about the integration of QAbstractItemModel related
classes and QML types not being ideal. The recent addition of
QItemSelectionModel support (for the TreeView) is a significant step
forward, but some utilities are still missing.
Mostly what's missing is just some declarative-friendly APIs for things
that already exist in an imperative form. I've written several such
components in work over the last year which I am upstreaming when I get
the chance.
Here's the SelectionInfo element, which I find particularly useful, and
I just now uploaded:
https://codereview.qt-project.org/#/c/150234/
It allows querying in a declarative way whether a particular QModelIndex
is 'selected' or 'current'. I'd be happy for any feedback at this point!
Thanks,
Steve.
--
Ableton AG, Schoenhauser Allee 6-7, 10119 Berlin, Germany
Management Board: Gerhard Behles, Jan Bohl
Chair of the Supervisory Board: Uwe Struck
Registered Office: Berlin, Amtsgericht Berlin-Charlottenburg, HRB 72838
_______________________________________________
Development mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/development