Very slow resizing with QHeaderView::ResizeToContents



  • Hi,

    I'm using a QTableView to present data from a QStandardItemModel. I was looking for hours for a solution to make the rows resize properly and the only solution I've found was QHeaderView::ResizeToContents. I was expecting some extra overhead, but the truth is that resizing is painfully slow. Currently I'm loading some 4k records, but I expect to use the final app with more than 100k records, so resizing this way will be almost impossible.

    Is there any other snappier way to resize the rows?

    TIA



  • Seriously: you are trying to resize the columns so it fits all rows, and you're using 40-100k rows of which you have to calculate the size, and you wonder why that is slow?

    How about you just, by experimentation and your knowledge of the data, define some sane default size and let the user resize if needed?



  • [quote author="Andre" date="1343207977"]Seriously: you are trying to resize the columns so it fits all rows, and you're using 40-100k rows of which you have to calculate the size, and you wonder why that is slow?

    How about you just, by experimentation and your knowledge of the data, define some sane default size and let the user resize if needed?[/quote]

    Thanks for your reply.

    Columns are resized with QHeaderView:Stretch. Letting the user resize the row height is not desirable for the purpose of the app. I just want every row to adjust its height so all the text is visible to the user. Currently I am using 4000 records.

    Thanks again.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.