Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [SOLVED] QTreeview Custom model and QSortFilterProxyModel - changing data
Qt 6.12 LTS is out! See what's new in the release blog

[SOLVED] QTreeview Custom model and QSortFilterProxyModel - changing data

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 1.5k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    prady_80
    wrote on last edited by
    #1

    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.

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt
    • Unsolved