Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/workflows/test-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,12 @@ jobs:
pytest-cov
pytest-timeout

- name: Install CPython dependencies
if: "!contains(matrix.python-version, 'pypy')"
run: >
python3 -m pip install
PyQt6

- name: Install dependencies
id: install
run: |
Expand Down
5 changes: 4 additions & 1 deletion src/PIL/ImageQt.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,4 +213,7 @@ def toqimage(im: Image.Image | str | QByteArray) -> ImageQt:

def toqpixmap(im: Image.Image | str | QByteArray) -> QPixmap:
qimage = toqimage(im)
return getattr(QPixmap, "fromImage")(qimage)
pixmap = getattr(QPixmap, "fromImage")(qimage)
if qt_version == "6":
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This "6" means PyQt, and "side6" would mean PySide6.

Do we know if this also affects PySide6?

Copy link
Member Author

@radarhere radarhere Oct 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm unable to replicate the problem on Windows on GitHub Actions with PySide6.

If I run the test suite with PySide6 without this fix, it passes.

Furthermore, detach() doesn't exist in PySide6 - https://doc.qt.io/qtforpython-6/PySide6/QtGui/QPixmap.html / https://github.com/python-pillow/Pillow/actions/runs/11554805812/job/32158808074#step:6:5698. It is possible they don't offer it precisely because it isn't needed?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for testing, let's merge. We'll have to see what happens when/if PyQt7 comes out in the future.

pixmap.detach()
return pixmap