Results 1 to 3 of 3

Thread: QTableView slow scrolling

  1. #1
    Join Date
    Sep 2015
    Posts
    36
    Thanks
    1
    Qt products
    Qt5
    Platforms
    Windows

    Default QTableView slow scrolling

    I have a problem with QTableView. Model which I want to display has about 400k of samples (and it's really not much, it's supposed to work with many millions of samples). It's 27 columns with over 13k rows right now. Unfortunately scrolling is very slow. If someone moves mouse cursor quite dynamically he will have to wait good amount of time until scroll bar actually meets vertical position of cursor again. Where can I search for performance drops? What can I do to make it silky smooth? Or maybe it's qt classes that are slow? Data loads from file in an instant. It just appears immediately. Yet slowdown at scrolling is definitelly visible. If window is smaller, then scrolling is faster. It seems that's directly connected to number of samples currently being displayed on screen (rather not total number of samples inside model).
    Last edited by Khaine; 21st March 2016 at 17:52.

  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: QTableView slow scrolling

    First thing you could check is how fast the model is without a view.

    • Instantiate the model
    • Ask for its rowCount()
    • Iterate over all rows
      - Ask for the row's columnCount()
      - Iterate over the columns
      * Ask for each columns data, at least the Qt::DisplayRole



    Cheers,
    _

  3. #3
    Join Date
    Sep 2015
    Posts
    36
    Thanks
    1
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: QTableView slow scrolling

    I did tests and model is not a problem here.

    Qt Code:
    1. qDebug() << "Iteration test start";
    2. timer.start();
    3. rows = dataSetModel->rowCount();
    4. columns = dataSetModel->columnCount();
    5.  
    6. for (int i = 0; i<rows; i++){
    7.  
    8. for (int j = 0; j<columns; j++){
    9.  
    10. value = dataSetModel->data(dataSetModel->index(i,j));
    11.  
    12. }
    13.  
    14. }
    15.  
    16. qDebug() << "Time elapsed: " << timer.elapsed();
    To copy to clipboard, switch view to plain text mode 

    Tests for 30 columns and 14k rows show that iterating all samples takes 55 ms.

    Tests for 30 columns and 200k rows give us 735 ms to iterate and copy value of each sample (I ordered it to copy received QVariant to empty QVariant value).

    So I would say, that model is pretty fast. Also there is no difference if model has 420k samples or 6kk samples, scroll lag is absolutely the same. So problem is with graphical representation by QTableView.

Similar Threads

  1. QTableView not scrolling
    By waynew in forum Qt Programming
    Replies: 5
    Last Post: 10th July 2017, 23:58
  2. QTableView and stylesheet horizontal scrolling problem
    By aphexgt in forum Qt Programming
    Replies: 0
    Last Post: 18th October 2012, 23:00
  3. Slow navigating around a QTableView
    By pwaldron in forum Qt Programming
    Replies: 0
    Last Post: 8th March 2011, 18:24
  4. Slow problem QTableView
    By skuda in forum Qt Programming
    Replies: 6
    Last Post: 26th February 2008, 12:19
  5. Scrolling items in QTableView
    By steg90 in forum Qt Programming
    Replies: 2
    Last Post: 8th May 2007, 12:59

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.