Skip to content

Commit

Permalink
Merge pull request #8509 from radarhere/toqpixmap
Browse files Browse the repository at this point in the history
Detach PyQt6 QPixmap instance before returning
  • Loading branch information
hugovk authored Oct 29, 2024
2 parents 0fd6086 + 73600ee commit e214dbf
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
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":
pixmap.detach()
return pixmap

0 comments on commit e214dbf

Please sign in to comment.