PDA

View Full Version : Accessing single items from QAbstractListModel in QML



Slash200
12th December 2018, 08:38
Hello,

I have a c++ class derived from QAbstractListModel which I use as my Datamodel for QML.
It has hundrets of objects in it which I want to access directly in QML.
Using the whole model e.g. in a list ist working.


ListView {
width: 100; height: 800

model: dataSourceModelObject
delegate: Text { text: name + " " + value}
}


But I want to access single objects of this ListModel by the ID of the object. Is this possible?

regards

anda_skoa
25th December 2018, 12:43
What are these objects that your model is interfacing with?

Are they accessible from QML, i.e using Q_OBJECT or Q_GADGET for defining properties?

Cheers,
_