# Place Image in PyQt QTableWidget Header

• I am trying to create a QTableWidget that has a thumbnail image in it's vertical header (and eventually some text under it). My current attempt is to subclass the QTableWidgetItem...

class ShotHeader(qt.QTableWidgetItem):
imagePath = os.path.join(r'T:\path\to\image.jpg')
shotThumbnailPixMap = QPixmap(imagePath).scaledToWidth(60)

def __init__(self):
self.setData(QtCore.Qt.DecorationRole, self.shotThumbnailPixMap)


And later on this is set via

shotInterface = QTableWidget(rows, cols)
for row in range(rows):


Which does show the image, but it seems to be an icon which I cannot change the size of, as can be seen in the following image...

Obviously, I'm looking for a way to make the images a decent size,
I have searched quite extensively for a solution to this problem, but have so far come up with nothing. No amount of scaling the QPixmap has any effect.
I'd really appreciate some help on this.

• my "guess" is that the available space reserved by the table is the limiting factor. Remember, everything is governed by layouts and their constraints. you mention scaling of the pixmap, but what happens if you set its size constraint values; specifically its minimumSize()?

• @Kent-Dorfman From the docs for QPixmap and QTableWidgetItem (which I'm using as the vertical header) there doesn't seem to be any functions to set or examine minimum size.
I've also tried setSizeHint for the QTableWidgetItem.
Nothing will change he icon size.

• Anyone have any clues at all?
As you can see from my Stack Exchange question here a user showed that he managed to do it, but then he disappeared.