> But when childAdded is called… child already has been added. That's the 
> issue, model is not manipulating data, it's just supposed to react on their 
> changes

OK, I finally decided to look at our code and the documentation :)

QAbstractItemModel has protected functions beginInsertRows and endInsertRows, 
as well as a few other beginXxx and endXxx functions. When data is added to the 
underlying data set, you call beginInsertRows(), do your work of packaging up 
QModelIndexes and inserting them, then call endInsertRows(). Since your 
subclass of QAbstractItemModel is only a representation of the data, not the 
data itself, you don't care of the childAdded signal comes after a data item 
has been added. At that point you prepare a new row in your QAbstractItemModel 
subclass.

Where does your data come from? How do you know when new data is added to the 
underlying data set?

-John Weeks

_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to