Results 1 to 3 of 3

Thread: QTableView / QHeaderView performance / Blocking signals to an object

  1. #1
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default QTableView / QHeaderView performance / Blocking signals to an object

    I have a QTableView with custom modal that has upto 1 million rows, with data being added 10 times a second. Old data is removed if the data ever exceeeds 1 million.

    This uses a suprising amount of cpu time considering how simple it is. Using a performance analyser, it seems that the entire tableview is read for every single row addition after the model calls endInsertRows(). In particular, QHeaderView::isSectionHidden and a few other methods are called for every single row, so approx 1 million times for each row added, and this seems to be where most of the cpu usage is.

    Also the entire QTableView is repainted after every addition, even when the new data isn't visible and there was no changes to existing data.

    Is this normal? And if so, why is QHeaderView being so CPU intensive? Column sizes are set manually so it shouldn't need to read the row data at all ? Can I block QHeaderView from receiving signals whilst I add an item to confirm these findings? It seems not as blockSignals only stops them from being transmitted, not received (and I need the signal to be received by the scrollbar), and eventfilter doesn't handle signals...

  2. #2
    Join Date
    Dec 2010
    Location
    Israel
    Posts
    90
    Thanks
    59
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QTableView / QHeaderView performance / Blocking signals to an object

    Shame no one replied here

  3. #3
    Join Date
    Nov 2012
    Posts
    1

    Default Re: QTableView / QHeaderView performance / Blocking signals to an object

    i face the same behaviour with qt 4.6. Is there any hint how to fix this?

    I have a customized qheaderview for my qtableview. The view gets a QSortFilterProxyModel holding a customized AbstractItemModel as sourceModel.

    If I add 1000000 million rows to the empty model it works fast. If i now add further lines qt calls (for example) the sizehint of the headerview for each added line. This takes ages...

    Is there any explanation/fix.

    Thanks for any hint.

    PS. updating the qt version is not an option

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.