Scale pixmap image in QHeaderView

John Sturtz john at sturtz.org
Sun Oct 19 21:08:28 BST 2025


Hello again.

Attached is a short bit of code that displays a QTableView with a custom 
QHeaderView.  The .headerData() method loads a 64x64 PNG and returns it 
for DecorationRole.

Can anyone tell me why the .scaled() call on line #61 can't make the 
header image larger?  If I change the argument to .scaled() to QSize(8, 
8), it makes the image small.  So the .scaled() call is evidently having 
an effect.  But if I specify QSize(64, 64), it doesn't get anywhere near 
as large as 64x64.  I've been unable to determine why.

Thanks!

/John
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20251019/f6d5b8c1/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: post.py
Type: text/x-python
Size: 2522 bytes
Desc: not available
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20251019/f6d5b8c1/attachment.py>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: delete.png
Type: image/png
Size: 652 bytes
Desc: not available
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20251019/f6d5b8c1/attachment.png>


More information about the PyQt mailing list