Detach PyQt6 QPixmap instance before returning

This commit is contained in:
Andrew Murray 2024-10-29 00:34:24 +11:00
parent 9a4b3e05d6
commit 73600eea94
2 changed files with 10 additions and 1 deletions

View File

@ -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: |

View File

@ -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