[Interest] Design Issue with QAbstractItemModel & QTreeView

Sébastien Le Ray sebastien-qt at orniz.org
Fri Aug 5 00:12:01 CEST 2016



Le 04/08/2016 à 23:34, John Weeks a écrit :
>> On Aug 4, 2016, at 2:19 PM, Sébastien Le Ray <sebastien-qt at orniz.org> wrote:
>>
>> That's what I do, but the signal says childAdded, where model needs childWillBeAdded and childHasBeenAdded to handle beginInsertRows/endInsertRows, same for the removal so that's not working. Worst case is for the removal, since beforeRemoveRows triggers accesses to the to-be-removed rows you can run into serious issues if the child has been delete'd
> If I recall correctly, you would respond to childAdded by first calling childWillBeAdded, doing the work of adding the child, then calling childHasBeenAdded. The WillBe and HasBeen functions are used to inform the base class of what your code is doing.

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



More information about the Interest mailing list