QTableWidget images not drawing properly in MacOS- partly resolved
-
Re: QTableWidget images not drawing properly in MacOS
This was a thread I started four months ago, but I've finally managed to get somewhere with it, so I thought I'd post here in case anyone else encounters the same issue in the future.
In a PyQt5 application using a QTableWidget, I was having problems with images not displaying properly in cells, as shown in the screenshots in the previous thread.
My new discovery is that this only happens if the pixel size of the image is greater than or equal to the pixel size of the cell.
If you try and display a 160x90 image in a 160x90 QTableWidget cell on Windows, it works fine- but on a Mac, it gives terrible results, not painting properly and giving very odd results when scrolled.
However if you put a 160x90 image into a 161x91 cell- just adding a pixel in each direction- then it displays absolutely fine on both Windows and Mac.
I guess this might qualify as a Mac bug (either in Qt or PyQt, I'm afraid I don't know which), but of course the workaround of adding an extra pixel is very straightforward.
I hope this helps somebody in the future. Hello the future!
-
Hi again,
Glad you found a workaround. You should check if there's something related on the bug report system. If not, please consider creating a new issue providing a minimal compilable example.