Results 1 to 3 of 3

Thread: Proxy model invalidation after dataChanged() emit

  1. #1
    Join Date
    Sep 2010
    Posts
    62
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Proxy model invalidation after dataChanged() emit

    Hello,

    It seems, that the proxy model does not invalidate the filter automatically when dataChanged() is emit by the model.
    e.g. after removing an item from the model a neighbor items is shown twice in the proxy with filter set. (filterAcceptsRow() and lessThan() methods overwritten)
    Any experiences in this area?
    After calling invalidate() on proxy model everything works fine.

    Pls. let me know if this is the normal behavior or I am doing something wrong.

    THX

  2. #2
    Join Date
    Mar 2010
    Location
    ua
    Posts
    4
    Thanks
    2
    Thanked 2 Times in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Proxy model invalidation after dataChanged() emit

    Note: By default, the model does not dynamically re-sort and re-filter data whenever the original model changes. This behavior can be changed by setting the dynamicSortFilter property.
    seems your case

  3. #3
    Join Date
    Sep 2010
    Posts
    62
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Proxy model invalidation after dataChanged() emit

    Hi,

    Thanks for the answer.
    I've forgotten to write it; the setDynamicSortFilter propriety is set to true in the proxy (in c-tor), but not in the model. Hence the proxy shall filter and sort I think that it is correct.
    Shall I set it also in the model?
    The other thing is, that without invalidation proxy reacts "somehow" on the changes,
    e.g. after insert rows everything works fine. Problems seem to occur when rows are removed.

    I am grateful for further hints.

Similar Threads

  1. Custom Model and Proxy Model
    By frank100 in forum Qt Programming
    Replies: 1
    Last Post: 20th December 2010, 14:30
  2. A Totalling Proxy Model?
    By ChrisW67 in forum Qt Programming
    Replies: 2
    Last Post: 7th April 2010, 03:06
  3. questions about datachanged() in model/view programming
    By calmspeaker in forum Qt Programming
    Replies: 1
    Last Post: 8th September 2008, 23:48
  4. Model, View and Proxy
    By No-Nonsense in forum Qt Programming
    Replies: 2
    Last Post: 21st November 2006, 08:50
  5. Model and Proxy
    By larry104 in forum Qt Programming
    Replies: 1
    Last Post: 4th August 2006, 21:05

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.