Results 1 to 8 of 8

Thread: Custom QSortFilterProxyModel for filtering large data

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Dec 2016
    Posts
    16
    Thanks
    2
    Thanked 1 Time in 1 Post
    Qt products
    Qt4

    Default Custom QSortFilterProxyModel for filtering large data

    I have a model sub-classed from QAbstractTableModel, which shows around 1.5 million rows. There is a QSortFilterProxyModel used to filter over this original model. Two problems are that filtering is real slow and it hangs the GUI.
    I am using Qt4.6 and I did explore Qt5 but I doesnt seem to have significant improvements to the performance of QSortFilterProxyModel.

    I have thought of an approach (still theoretical) - with two goals
    A) to give the user whatever results are obtained as they are available (i.e. row accepted by filterAcceptsRow)
    B) to not let the GUI freeze and have user abort the operation to see partial results of filtering only.

    To achieve this the plan is (theoretical still) is as follows:
    1) Split the original model into smaller models e.g. 100 models of 15K rows each (have to think of way to do this without duplicating the entire data stored in original model).
    2) Perform the filtering on first model - results should be back within 1 second.
    3) Show the obtained results in a view (using a temp model that can be appended to?)
    4) If a "Stop" button has been pressed stop here - indicating this is partial result of filtering only (my users will be Ok with that).
    5) Schedule the step 2 using a zero timeout QTimer (i.e. process will start after events in QT event loop are serviced) for the "next" model.

    Would like to hear about advice regarding this approach, will it really solve the two goals in mind?
    What details should I care about to avoid too much book-keeping costs in terms of memory and run-time?

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Custom QSortFilterProxyModel for filtering large data

    My preference for advanced sorting and/or filtering is to do it in the model itself.

    A proxy model is nicely generic but that also implies it can use knowledge about the data and the structures inside the main model.

    The main model can easily apply filtering iteratively, progressively, etc.

    Cheers,
    _

Similar Threads

  1. QSortFilterProxyModel "inverse" filtering
    By aguayro in forum Newbie
    Replies: 1
    Last Post: 27th September 2014, 14:36
  2. Find out when filtering is doing in QSortFilterProxyModel
    By alizadeh91 in forum Qt Programming
    Replies: 5
    Last Post: 26th February 2013, 22:00
  3. Replies: 3
    Last Post: 6th June 2011, 13:34
  4. QSortFilterProxyModel not filtering properly
    By freemind in forum Qt Programming
    Replies: 9
    Last Post: 8th August 2010, 01:23
  5. Replies: 1
    Last Post: 10th January 2008, 14:38

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.