[Development] QML and QAbstractListModel
Joseph Crowell
joseph.w.crowell at gmail.com
Sun Jan 13 13:15:16 CET 2013
On 01/13/2013 10:09 PM, Johan Thelin wrote:
>
> Sorry for top-posting. I'm writing from my phone.
>
> I've had a class like this for a project of mine. It exposed signals
> for adding, removing and changing rows as well as the count, data and
> setData methods.
>
> This helped me peek and poke at a QAbstractLisaModel from JavaScript.
>
I bet she loved it.
>
> Cheers,
>
> Johan
>
> On Jan 13, 2013 12:40 PM, "Alberto Mardegan"
> <mardy at users.sourceforge.net <mailto:mardy at users.sourceforge.net>> wrote:
>
> On 01/12/2013 11:59 PM, Nils Jeisecke wrote:
> > Hi,
> >
> > what about adding a new Quick item for "enhanced
> QAbstractItemModel access".
> >
> > ListModelAdapter {
> > id: myModelAdapter
> > sourceModel: myModel
> > }
> >
> > ListView {
> > model: myModelAdapter.sourceModel
> > delegate: Text {
> > MouseArea {
> > onClicked: console.log(myModelAdapter.data(model.index,
> "myRole")
> > }
> > }
> > }
>
> That would also work just for QAbstractListModel, unless we find a way
> to present QModelIndex to QML.
> If the proposal of adding the "count" property and the "get" method to
> QAbstractListModel doesn't get accepted, IMHO the best thing to do
> is to
> provide either code snippets or a *C++* helper class to help implement
> those things, rather then workaround the limitations from the QML
> side.
> We are talking about C++ models in any case, so I see more fit a
> solution on the C++ side.
>
> Ciao,
> Alberto
> _______________________________________________
> Development mailing list
> Development at qt-project.org <mailto:Development at qt-project.org>
> http://lists.qt-project.org/mailman/listinfo/development
>
>
>
> _______________________________________________
> Development mailing list
> Development at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/development
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20130113/35147bed/attachment.html>
More information about the Development
mailing list