[Qt-interest] QAbstractProxyModel methods index, parent, rowCount, columnCount not implemented?

Andre Somers andre at familiesomers.nl
Wed May 18 16:28:45 CEST 2011


Op Wo, 18 mei, 2011 3:43 pm, schreef Stephen Kelly:
> Andre Somers wrote:
>
>>> Yes, you'd also want to test it for things like layoutChange (during
>>> which anything can happen).
>> Yes, I think you are right. Though I think it will be very tricky to
>> deal with this particular case. I may have to resort to documentation:
>> "Don't use this class on item models that may change their layout", or
>> just do a reset of the internal data if that happens. Anyway, I do have
>> to look into this.
>
> Well, the layoutChange should include updating the QPersistentModelIndexes
> (if the source model is implemented correctly), so you shouldn't have to
> restrict it to source models that don't change. The current implementation
> including layout change handling from QSFPM might be all you need
> QPersistentModelIndexes are used enough, though again, I haven't
> investigated really.

Problem in my case is, that the state of an item that is moved can
actually be kept in a parent node (an entire subtree with the same checked
state would have only one actual data point stored in the top of that
subtree). I'm not saying that it is impossible to deal with, but it _may_
be more trouble than it is worth.

> It might have similar issues to the reset stuff. Layout change can result
> in
> things moving, being inserted and being removed all at the same time. If
> you
> store internal data in the proxy which relates to the source model or
> source
> indexes, how do you know what parts of the data to clear. All of it? Even
> then you still have to do that at the correct time, just like the reset
> stuff.
>
> Anyway, I'm just brain-dumping at this point. Someone would need to think
> though all the code paths to determine if something needs to be fixed.
>
> All the best,
Thanks. Your insights are appreciated.

André





More information about the Qt-interest-old mailing list