[Interest] QML data models question

Sven Anderson Sven.Anderson at snom.com
Wed Jul 11 14:53:26 CEST 2012

Hi Harri,

On 11.07.2012 11:02, Harri Pasanen wrote:
> How do I access list model data properties without a delegate?

I had the same problem. To the class MyModel that inherits from 
QAbstractListModel I added a property

Q_PROPERTY(QDeclarativeListProperty<MyItem> myItems READ myItems NOTIFY 

with according methods, and then I also could access the items in the 
model (let's say with id "my_model") in QML with my_model.myItems[n]. I 
also would prefer if I could use the [] operator directly on the 
my_model (that is my_model[n]), but I couldn't find out how yet. 
Multiple inheritance? Maybe someone on this list has an idea?

Best regards


More information about the Interest mailing list