Domanda

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.

È stato utile?

Soluzione

this should work:

self.ui.tableWidget.setCellWidget(i, j, svgWidget)
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top