Results 1 to 4 of 4

Thread: fast alternative for hiding of rows of QTableView

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Mar 2011
    Posts
    45
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default fast alternative for hiding of rows of QTableView

    hi folks,

    i am writing a software that displays logfile data within a QTableView.
    in some cases the displayed file content can be several 100 MB of size.

    I allready managed to put the whole content into the tableview by subclassing QAbstractTableModel in one go, so that works fine.

    but now the problem and would like to get some ideas in regard to this, hope u can help:

    there shall be filtering functionalities like: "find all rows that match a certain pattern"

    i thought maybe hiding the appropriate rows could be an option to display the result, but that turned out to be quite slow:

    Qt Code:
    1. QModelIndex start = tableModel->index(0, 0);
    2. QModelIndexList list = tableModel->match(start,
    3. Qt::DisplayRole,
    4. "*DEBUG*",
    5. -1,
    6. Qt::MatchWildcard);
    7.  
    8. ui->tableView->setUpdatesEnabled(false);
    9. for(ushort idx=0; idx<list.size();idx++)
    10. {
    11. int row = list[idx].row();
    12. ui->tableView->hideRow(row);
    13. }
    14. ui->tableView->setUpdatesEnabled(true);
    To copy to clipboard, switch view to plain text mode 

    i know that the parameters for tableModel::match(...) do certainly have an effect on speed, but i think its more the amount of rows within the table.

    so, any ideas how this kind of filtering could be implemented without having a bottle neck as this?
    hiding rows is not mandatory, so if u have other ideas how to display results i would appreciate.

    thnx alot.
    greets.

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: fast alternative for hiding of rows of QTableView

    QSortFilterProxyModel is made for this sort of thing.

  3. #3
    Join Date
    Mar 2011
    Posts
    45
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: fast alternative for hiding of rows of QTableView

    ok, that looks good, but:

    within that qt-example u mention i changed the initial data to be 1000 times bigger (that is far less than i have) and what happens is,
    that the filtering functionality gets slow too: whenever one changes the filter it takes several seconds for the results view to be updated,
    so i am curious if this QSortFilterProxyModel is not just a kind of wrapper for the initial attempt of filtering (see my code above).

    the speed issue is still there i think.

Similar Threads

  1. QTableView with icons in rows
    By kasper360 in forum Newbie
    Replies: 6
    Last Post: 5th April 2011, 06:24
  2. Disable row/rows in QTableView
    By scott_hollen in forum Qt Programming
    Replies: 6
    Last Post: 28th March 2011, 18:16
  3. QTableview Sorting and hiding
    By hmarani in forum Newbie
    Replies: 8
    Last Post: 28th February 2011, 15:05
  4. Replies: 3
    Last Post: 9th December 2010, 19:27
  5. QTableView 2 rows inside every row
    By skuda in forum Qt Programming
    Replies: 3
    Last Post: 22nd April 2009, 09:23

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
  •  
Qt is a trademark of The Qt Company.