I have been able to get data from database and populate into the tableWidget, but the image column is not shown. I tried a code I found online and still, it didn\'t work. The im
The logic to use the bytes (in my previous answer I proposed to use base64 so I use it in this case as well) to build a QPixmap that can be converted into a QIcon that can be displayed in the QTableWidget:
for row_number, row_data in enumerate(rows):
self.ui.tableWidget.insertRow(row_number)
for column_number, column_data in enumerate(row_data):
it = QTableWidgetItem()
if column_number == 1:
pixmap = QPixmap()
pixmap.loadFromData(QByteArray.fromBase64(row_data))
icon = QIcon(pixmap)
it.setIcon(icon)
else:
it.setText(row_data)
self.ui.tableWidget.setItem(row_number, column_number, it)