Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Very slow resizing with QHeaderView::ResizeToContents
QtWS25 Last Chance

Very slow resizing with QHeaderView::ResizeToContents

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 3.1k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    panosk
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0
    • A Offline
      A Offline
      andre
      wrote on last edited by
      #2

      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?

      1 Reply Last reply
      0
      • P Offline
        P Offline
        panosk
        wrote on last edited by
        #3

        [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.

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved