Results 1 to 6 of 6

Thread: How to display QTableWidget fast with row > 10000?

  1. #1
    Join Date
    Oct 2007
    Posts
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default How to display QTableWidget fast with row > 10000?

    I use QTableWidget to display some dataset. If there are 10000 or more rows, it takes about 10 seconds. Is there anyway to speed up ? Thanks a lot.

  2. #2
    Join Date
    Jan 2006
    Location
    Ljubljana
    Posts
    687
    Qt products
    Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows Android
    Thanks
    111
    Thanked 4 Times in 4 Posts

    Default Re: How to display QTableWidget fast with row > 10000?

    From my experience in Clarion all browse boxes were dynamically loaded in per-page fashion. Try to load only so much records that will fit in browse widget. (For example, if you have 10000000 records in file and your browse widget is capable of showing 50 records per page, load them only 50). I know this is a lot of work to do because you must then rewrite scroll bar handling methods, which is not simple at all.
    Qt 5.3 Opensource & Creator 3.1.2

  3. #3
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts

    Default Re: How to display QTableWidget fast with row > 10000?

    QTableWidget is not designed as efficiency but as convenience in mind. You should consider switching to real model-view approach to have some efficiency.
    J-P Nurmi

  4. #4
    Join Date
    Jan 2006
    Location
    Ljubljana
    Posts
    687
    Qt products
    Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows Android
    Thanks
    111
    Thanked 4 Times in 4 Posts

    Default Re: How to display QTableWidget fast with row > 10000?

    Quote Originally Posted by jpn View Post
    QTableWidget is not designed as efficiency but as convenience in mind. You should consider switching to real model-view approach to have some efficiency.
    What do you mean with real model view?
    Qt 5.3 Opensource & Creator 3.1.2

  5. #5
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    8
    Thanked 541 Times in 521 Posts

    Default Re: How to display QTableWidget fast with row > 10000?

    He means QTableView. It is model based, while QTableWidget is item based.

  6. #6
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts

    Default Re: How to display QTableWidget fast with row > 10000?

    There is a huge difference for example while adding items. With QTableView + model you can optimize it so that all the 10000 items gets added at time and then the view is updated once. On the other hand, adding 10000 items to a QTableWidget causes a lot of interaction under the hood, between the hidden built-in model and the view. It's just that QTableWidget has to be bulletproof and to work in every possible situation which also makes it slow, unfortunately.
    J-P Nurmi

Similar Threads

  1. Replies: 12
    Last Post: 7th September 2011, 16:37
  2. QComboBox in QTableWidget : display troubles.
    By Nyphel in forum Qt Programming
    Replies: 2
    Last Post: 13th October 2007, 23:29

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.