[Interest] Design Issue with QAbstractItemModel & QTreeView

Sébastien Le Ray sebastien-qt at orniz.org
Thu Aug 4 23:19:55 CEST 2016



Le 04/08/2016 à 20:45, Igor Mironchik a écrit :
> Hi,
>
>
> On 04.08.2016 20:52, Sébastien Le Ray wrote:
>> Hi
>>
>> Thanks for your answer
>>
>> I know about xxxInsertRow but these are meant to be called by the
>> model (or at least by a class that has knowledge of the model). The
>> question is how to properly call it when the only notification you
>> get from the data is "this row was added|removed".
>
> You can use signal/slot mechanism to notify your model. I can't
> understand what is the problem. There are different solutions. Where
> you receive this notification?

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



More information about the Interest mailing list