Scale pixmap image in QHeaderView

John Sturtz john at sturtz.org
Sun Oct 19 21:13:31 BST 2025


Oops.  My bad.  Before I posted, I was trying different sizes to the 
.scaled() call.  I accidentally left it at QSize(24, 24).  What I really 
want to do is set it to 64x64.  Attached is the script I meant to post.

Sorry.

/John


------ Original Message ------
>From "John Sturtz" <john at sturtz.org>
To pyqt at riverbankcomputing.com
Date 10/19/2025 3:08:28 PM
Subject Scale pixmap image in QHeaderView

>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/c4302aa2/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/c4302aa2/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/c4302aa2/attachment.png>


More information about the PyQt mailing list