I'm a (Py)Qt newbie, porting C# GUI code to Qt for a couple of days now. One question that I keep asking myself is why are QAbstractItemModel
subclasses required to supply a parent()
method, and why are they required to supply, in the resulting QModelIndex
, the row of a child in the parent?
This requirement forces me to add another layer over my tree data (because I don't want to call indexOf(item)
in parent()
, it wouldn't be very efficient) that remembers row indexes.
I ask this because it's the first time I see a model based view require this. For example, NSOutlineViewDataSource
in Cocoa doesn't require this.
Trolltech devs are smart people, so I'm sure there's a good reason for this, I just want to know what reason.