Hi, I have a column that displays an image, but it is "cut off" where it is bigger than the cell size. I do not want to make the cell fit the image, just scale down the image, like a thumbnail. I have sub-classed QSqlTableModel and display the image in data() like this:
Is there some way to get the cell size, so I can return something like pixmap.scaled(cellSize), or find the lesser of scaledToHeigth() and scaledToWidth()? Or am I trying to go this in the wrong place?Qt Code:
if(header == "Image") { switch(role) { case Qt::DisplayRole: break; case Qt::DecorationRole: return pixmap; break; case Qt::UserRole: return link; } }To copy to clipboard, switch view to plain text mode
I use images in a different column, but I am free to use small enough images that they fit. Ultimately, I plan to use the tool tip to show the image full sized.
Bookmarks