How do I access list model data properties without a delegate?
I'm using a SelectionDialog with model: audioList
If audioList is implemented as QStringList in C++, I can access the
model data with audioList[selectedIndex].
However, when using QAbstractListModel, my intuition failed. I would
have thought that a syntax like audioList[selectedIndex].artist would
work, but it does not.
I then figured I'd cheat by making a public slot in audioList
QString artist(int atIndex)
I thought a call with audioList.artist(selectedIndex) would work, but no
go there either. Seems like the audioList model instance seems to be
some kind of special ethereal entity that does not follow normal rules
for QML objects.
Anyways, I got around it by using another rootContext property that
knows about the model, but I wonder if I'm missing an obvious and clean
way to do this.
Like, I know I can access the data in the delegate. Is there a way to
define a delegate just to access the instance properties, keeping the
default look and feel, including touch/mouse interaction logic?
Thanks,
Harri
_______________________________________________
Interest mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/interest