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. QTableWidget very slow
Forum Updated to NodeBB v4.3 + New Features

QTableWidget very slow

Scheduled Pinned Locked Moved General and Desktop
4 Posts 4 Posters 4.7k Views 1 Watching
  • 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.
  • mrdebugM Offline
    mrdebugM Offline
    mrdebug
    wrote on last edited by
    #1

    I need to insert in a qtablewidget 18000 rows and 50 columns.
    I normally use MyTable->setCellWidget(QLabel)
    but this requires a very long time and a very lot of memory.
    Is there another way? I need to display only text.

    Need programmers to hire?
    www.labcsp.com
    www.denisgottardello.it
    GMT+1
    Skype: mrdebug

    1 Reply Last reply
    0
    • raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by
      #2

      use QTableView with a custom model (subclass QAbstractTableModel for example).
      This should give you better results than with the overhead of the standard items.

      With a dataset of such a high count of entries it also makes sense to think about the structure you use to store them and use for look up in the model!

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      1 Reply Last reply
      0
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #3

        Hi,

        To add to raven-worx, why are you using setCellWidget ?

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

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

          You are creaing 900.000 widget instances and trying to scroll all of them, and then you are surprised that that doesn't perform well?

          I find that Q*Widget really are toy versions of the views, and IMnsHO they should not have been in Qt to begin with. Just use a custom model as suggested by raven-worx. It will perform much better. Note that an item view doesn't create widgets to display items. Instead, it renders only the items that actually need displaying.

          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