diff --git a/.github/workflows/test-mingw.yml b/.github/workflows/test-mingw.yml index b9d2abeb338..6125af0249e 100644 --- a/.github/workflows/test-mingw.yml +++ b/.github/workflows/test-mingw.yml @@ -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 \ diff --git a/src/PIL/ImageQt.py b/src/PIL/ImageQt.py index 32630f2ca44..e142f1f277e 100644 --- a/src/PIL/ImageQt.py +++ b/src/PIL/ImageQt.py @@ -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