Results 1 to 6 of 6

Thread: TableView resizeColumnsToContents Slow on large sets of data.

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    May 2011
    Posts
    20
    Thanked 3 Times in 3 Posts
    Platforms
    Unix/X11

    Default TableView resizeColumnsToContents Slow on large sets of data.

    I have a table with about 8000 rows and 10 columns. I noticed doing a resizeColumnsToContents is really slow. To speed this up I was going to implement my own that will take the max of the first 25 cells in each column and use that as the column width. Each Cell uses a custom delegate so I want to use the delegate's sizeHint for each cell. Calling sizeHintForIndex( QModelIndex ) does not seem to return the delegate's sizeHint. How can I get the delegate's sizeHint for each cell?

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: TableView resizeColumnsToContents Slow on large sets of data.

    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    May 2011
    Posts
    20
    Thanked 3 Times in 3 Posts
    Platforms
    Unix/X11

    Default Re: TableView resizeColumnsToContents Slow on large sets of data.

    shouldn't sizeHintForIndex() call that for me? Maybe I am missing something here but it seems like poor implementation to provide a function that returns a sizeHint that makes no sense.

    What should I use for QStyleOptionViewItem ? The TableView or Delegate do not appear to have a getQStyleOptionViewItem function (that I can find).

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: TableView resizeColumnsToContents Slow on large sets of data.

    Quote Originally Posted by snydesc View Post
    shouldn't sizeHintForIndex() call that for me?
    Maybe it does but it also does a bunch of other stuff. You asked for a method "returning the delegate's size hint" -- it's called sizeHint().

    Maybe I am missing something here but it seems like poor implementation to provide a function that returns a sizeHint that makes no sense.
    I don't understand what you mean.

    What should I use for QStyleOptionViewItem ?
    It depends on what you want to get a size hint for.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. #5
    Join Date
    May 2011
    Posts
    20
    Thanked 3 Times in 3 Posts
    Platforms
    Unix/X11

    Default Re: TableView resizeColumnsToContents Slow on large sets of data.

    I would have thought that TableView->sizeHintForIndex() returns the sizeHint of the delegate used for that cell. It does not make sense that it would return a different sizeHint since the table uses the delegate's sizeHint to make the cell the correct size.

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: TableView resizeColumnsToContents Slow on large sets of data.

    Quote Originally Posted by snydesc View Post
    I would have thought that TableView->sizeHintForIndex() returns the sizeHint of the delegate used for that cell.
    The delegate is only a part of the size calculation aspect.

    It does not make sense that it would return a different sizeHint since the table uses the delegate's sizeHint to make the cell the correct size.
    Sure it does. What if you drag the table header with the mouse increasing the column/row size? Should the sizeHint still be what the delegate reports?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Deleting large QTable too slow
    By MaryannSpillane in forum Qt Programming
    Replies: 0
    Last Post: 24th September 2010, 23:02
  2. Replies: 1
    Last Post: 23rd September 2010, 06:45
  3. Replies: 6
    Last Post: 13th January 2010, 19:44
  4. Creating images from sets of data.
    By maverick_pol in forum Qt Programming
    Replies: 5
    Last Post: 26th February 2008, 10:25
  5. QWT and large amounts of data
    By ko9 in forum Qwt
    Replies: 1
    Last Post: 17th October 2007, 06:28

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.