Inserting QSvgWidget in QTableWidget cell
-
06-07-2021 - |
Question
What I want to do is to load .svg file and show (render) it in qtableWidget cell. First part I've done like this:
svgWidget = QSvgWidget("C:\mySVG.svg")
svgWidget.setMaximumSize(100,100)
next line renders svg like what I expected:
widget.show()
but when I've tried this:
self.ui.tableWidget.setItem(i, j, QtGui.QTableWidgetItem(svgWidget))
self.ui.tableWidget.setItem(i, j, svgWidget)
neither of those lines inserts svgWidget in tableWidget cell. How should I do that? Examples would be appreciated, I'm still a noob.
La solution
this should work:
self.ui.tableWidget.setCellWidget(i, j, svgWidget)
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow