[Interest] Design Issue with QAbstractItemModel & QTreeView

John Weeks john at wavemetrics.com
Thu Aug 4 23:34:32 CEST 2016


> 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.

-John Weeks




More information about the Interest mailing list