Merge pull request #5775 from hugovk/mingw-qt6

This commit is contained in:
Hugo van Kemenade 2021-10-18 12:38:14 +03:00 committed by GitHub
commit b4bd8943fa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 2 deletions

View File

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

View File

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