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 and pictures
Forum Updated to NodeBB v4.3 + New Features

QTableWidget and pictures

Scheduled Pinned Locked Moved General and Desktop
6 Posts 2 Posters 7.8k 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.
  • N Offline
    N Offline
    Nico2050
    wrote on last edited by
    #1

    Hi all,

    First of all excuse me for my English.

    In my application I need to show a QTableWidget (5 text columns and 4 pictures (or QPushButton with picture) columns).
    I use for exemple
    @
    ta->setCellWidget(row,3,wsr); // ta = QTableView & wsr = object inherited from QWidget
    @

    but when I want to load my QTableWidget it's very slow (about 4 seconds for only 100 rows) .
    Is it possible to run this part of my application by an other way more efficient ?

    Thank you in advance

    Nico

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

      If all you need is images in your table, you can just insert images in your model. That would be much faster than using widgets in your table.

      See QTableWidgetItem::setIcon(), and note that a QIcon can be constructed from an image file URL, a QPixmap or a QImage.

      1 Reply Last reply
      0
      • N Offline
        N Offline
        Nico2050
        wrote on last edited by
        #3

        Thanks for your reply.

        I need to display several small pictures in the same cell or a QPushButton which contains picture :s

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

          In both cases, you need to merge the images to a single image yourself.

          1 Reply Last reply
          0
          • N Offline
            N Offline
            Nico2050
            wrote on last edited by
            #5

            OK I'll try :-)

            But do you think that for my QPushButton use delegate can resolve my problem ?

            Thank you for your help

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

              [quote author="Nico2050" date="1302082808"]
              But do you think that for my QPushButton use delegate can resolve my problem ?
              [/quote]
              No, I don't think so. Delegates are not widgets that are visible 100% of the time. The widgets are only there at editing time. The rest of the time, the delegate is supposed to handle the rendering by itself.

              On the woes of using widgets in item views there is plenty to be found on this forum, and on other channels such as the qt-interest mailing list archives.

              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