QTableWidget and pictures



  • 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



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



  • Thanks for your reply.

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



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



  • OK I'll try :-)

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

    Thank you for your help



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


Log in to reply
 

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