Results 1 to 2 of 2

Thread: 1 large model dataset, 3 filter proxies, how to trigger layoutChanged selectively?

  1. #1
    Join Date
    Apr 2017
    Posts
    2
    Qt products
    Qt5
    Platforms
    Windows

    Question 1 large model dataset, 3 filter proxies, how to trigger layoutChanged selectively?

    The model has a large data set of datetime values (spanning several months). Each of the three filter proxies has a small date range (one day, one week and one month) that each uses in filterAcceptsRow() to filter and update three different windows

    Currently when I modify a narrow date range in the model and emit layoutChanged(), all three filter proxies respond and re-layout which is noticeably slow. This is wasteful when one or more of them of them are well outside the range modified. I tried to send a custom signal instead with the modified date range and in each proxy trigger layoutChanged manually if the modified range/proxy range overlap, but that doesn't work.

    I also tried using dataChanged( startIndex, endIndex ) but it did not prevent out-of-range proxies from updating. I think dataChanged() applies when the data changed is a subset of the filter proxy range, not out of range altogether.

    I've done a lot of searching and found no ideas so far. Anyone else worked with this problem?

  2. #2
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 452 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: 1 large model dataset, 3 filter proxies, how to trigger layoutChanged selectively

    Firstly what do you mean by "...narrow date range..." if just data values change then you should be using dataChanged() and not layoutChanged(), and if data structure / layout is changing then use layoutChanged() but read the Qt Docs, it clearly specifies the requirement to emit layoutAboutToBeChanged() and others steps to follow, not sure if you did those. Also double check startIndex and endIndex of dataChanged() signal, it is not much difficult to get them wrong. Further emiting layoutChanged() surely should trigger all the views and corresponding proxy models to refresh, as the term itself means "layout has changed", old layout is not valid. I would suggest to check dataChanged() indexes again.
    When you know how to do it then you may do it wrong.
    When you don't know how to do it then it is not that you may do it wrong but you may not do it right.

Similar Threads

  1. [SOLVED]How to reset a model filter ?
    By chiruL in forum Newbie
    Replies: 2
    Last Post: 10th September 2015, 23:02
  2. can we implement filter in model
    By prasad_N in forum Newbie
    Replies: 1
    Last Post: 8th July 2015, 18:39
  3. Model-View layoutChanged and modelindex
    By AndreasF in forum Qt Programming
    Replies: 0
    Last Post: 27th August 2012, 14:05
  4. Model/view, apply a filter on model
    By remy_david in forum Qt Programming
    Replies: 4
    Last Post: 4th February 2011, 18:13
  5. Set a filter on a model/view
    By graciano in forum Qt Programming
    Replies: 6
    Last Post: 13th June 2010, 18:07

Tags for this Thread

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.