Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
How does a Qtablewidget display images ？
zj.liu last edited by
I want to add an image in the Qtablewidget that fills the entire cell and changes along with the height and column width:
item = new QTableWidgetItem(); item->setData(Qt::DecorationRole, QPixmap(p_info->mSnap_path+"/"+p_info->mSnap_name).scaled(80,80,Qt::IgnoreAspectRatio)); this->compare_rec->setItem(row,0,item);
The image is displayed, but when I change the column width or row height, the image does not fill the entire cell:
Can it be done in any way?
You would need to implement a custom QStyledItemDelegate to scale the image.