PDA

View Full Version : Clarification about dataChanged



airbites
29th July 2009, 15:50
Hello,

I need an explanation about dataChanged() and beginInsertRows/endInsertRows().
I have implemented a model using QAbstractTableModel class and the model is editable; I'm not using setData() method to update the model but my own method that add or update an item to the model.
Can the method emit dataChanged() when item is inserted or I must use beginInsertRows/endInsertRows?
Or do both of beginInsertRows and endInsertRows emit dataChanged()?

Thank you a lot!

wysota
29th July 2009, 16:37
Can the method emit dataChanged() when item is inserted or I must use beginInsertRows/endInsertRows?
It must use beginInsertRows() and endInsertRows().


Or do both of beginInsertRows and endInsertRows emit dataChanged()?
They don't. dataChanged() is emitted only for existing indexes (there has to be some data first for it to change).

airbites
29th July 2009, 17:02
Thank you wysota. That really makes things clear ;)