Skip to content

Commit

Permalink
Merge pull request #5775 from hugovk/mingw-qt6
Browse files Browse the repository at this point in the history
  • Loading branch information
hugovk committed Oct 18, 2021
2 parents bc31502 + 033d1fc commit b4bd894
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test-mingw.yml
Expand Up @@ -42,7 +42,7 @@ jobs:
${{ matrix.package }}-python3-numpy \
${{ matrix.package }}-python3-olefile \
${{ matrix.package }}-python3-pip \
${{ matrix.package }}-python3-pyqt5 \
${{ matrix.package }}-python-pyqt6 \
${{ matrix.package }}-python3-setuptools \
${{ matrix.package }}-freetype \
${{ matrix.package }}-ghostscript \
Expand Down
8 changes: 7 additions & 1 deletion src/PIL/ImageQt.py
Expand Up @@ -66,7 +66,13 @@ def fromqimage(im):
:param im: QImage or PIL ImageQt object
"""
buffer = QBuffer()
qt_openmode = QIODevice.OpenMode if qt_version == "6" else QIODevice
if qt_version == "6":
try:
qt_openmode = QIODevice.OpenModeFlag
except AttributeError:
qt_openmode = QIODevice.OpenMode
else:
qt_openmode = QIODevice
buffer.open(qt_openmode.ReadWrite)
# preserve alpha channel with png
# otherwise ppm is more friendly with Image.open
Expand Down

0 comments on commit b4bd894

Please sign in to comment.