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

Stephen Kelly steveire at gmail.com
Wed May 18 15:43:39 CEST 2011


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. 

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,

Steve.





More information about the Qt-interest-old mailing list