[SOLVED] QTreeview Custom model and QSortFilterProxyModel - changing data



  • Hi I have data Displayed as a Tree using QTreeView + subclassed QSortFilterProxyModel and subclassed QAbstractItemModel which is a Dom hierarchy of data.
    I have overriden the SetData Method in my DOM model and am emiting dataChanged. Due to this it seems that the existing model indexes change as I have a filter criteria applied which for instance removes a row.

    Problem:
    Example:
    A
    +------- a1
    +--------a2
    +--------a3

    If I change data on A I am able to change data for a1,a2,a3 if after filtering through the proxy the filter criteria does not filter any of the rows. But if the filter criteria does then I am not able to change any data on a3. What could be the problem?


    I found out a solution. I was updating proxy indexes and hence once the index for a1 was updated after filtering indexes for a2 and a3 got invalid. Hence I switched to changing the source model and invalidated the proxy... things worked like a charm.
    Thanks.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.