Skip to content

Commit e214dbf

Browse files
authored
Merge pull request #8509 from radarhere/toqpixmap
Detach PyQt6 QPixmap instance before returning
2 parents 0fd6086 + 73600ee commit e214dbf

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

.github/workflows/test-windows.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,12 @@ jobs:
8080
pytest-cov
8181
pytest-timeout
8282
83+
- name: Install CPython dependencies
84+
if: "!contains(matrix.python-version, 'pypy')"
85+
run: >
86+
python3 -m pip install
87+
PyQt6
88+
8389
- name: Install dependencies
8490
id: install
8591
run: |

src/PIL/ImageQt.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,4 +213,7 @@ def toqimage(im: Image.Image | str | QByteArray) -> ImageQt:
213213

214214
def toqpixmap(im: Image.Image | str | QByteArray) -> QPixmap:
215215
qimage = toqimage(im)
216-
return getattr(QPixmap, "fromImage")(qimage)
216+
pixmap = getattr(QPixmap, "fromImage")(qimage)
217+
if qt_version == "6":
218+
pixmap.detach()
219+
return pixmap

0 commit comments

Comments
 (0)