3

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):
        super(ShotHeader, self).__init__()
        self.setData(QtCore.Qt.DecorationRole, self.shotThumbnailPixMap)

And later on this is set via

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

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...

Tiny thumbnail images which will not change.

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.

NB: I'm running PyQt in Houdini if that makes any difference.

eyllanesc
  • 235,170
  • 19
  • 170
  • 241
Anti-Distinctlyminty
  • 2,615
  • 5
  • 22
  • 24

0 Answers0