How does a Qtablewidget display images ?
-
wrote on 1 Sept 2020, 04:06 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:
-
Hi,
You would need to implement a custom QStyledItemDelegate to scale the image.
2/2