Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Stretch/Resize background image of QTableWidgetItem
hizoka last edited by hizoka
I have a new question for you :)
In a QTableWidget, I create QTableWidgetItems with a backgroung image.
I would like as the image resize with the size of the QTableWidgetItem.
I change the size of the cells but the image never resizing.
I can not do it...
Objet = QTableWidgetItem() Objet.setData(Qt.BackgroundRole, QBrush(Img))
I prefere do not use QLabel with stretch...
Any idea ?
For the moment, I use the resizeEvent of the QTableWidget and resend all pixmap with the good width.
That works but seems heavy...
did you try to scale Img ?
hizoka last edited by
Hi, thanks for your reply.
It's what I use in the resizeEvent (scaledToWidth).
So, Is it no way option for auto scaled the background image when the cell size change without use the resizeEvent ?
I never saw such option to have it do it automatically.
You could try with a delegate
where you handle the drawing of the img yourself.
Maybe someone knows an easier way :)