[Qt-interest] Adding an image to table cell

Eade, Sean (SCR US) sean.eade at siemens.com
Thu Jan 29 23:50:13 CET 2009


I have been trying to add an image to a cell in a table I have, but it
doesn't seem to want to work for me.

This is the code I am using:

 

    QIcon icon;

    icon.addPixmap(QPixmap(QString::fromUtf8("images/qt-logo.png")),
QIcon::Normal, QIcon::Off);

 

    QTableWidgetItem *tickItem = new QTableWidgetItem ();

      tickItem->setIcon(icon);

    ui.tableWidget->setItem(0, 0, tickItem);

 

Any reason why this doesn't work.

I am using QT4.4.3.

 

Thanks,

Sean

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090129/2b17856c/attachment.html 


More information about the Qt-interest-old mailing list