Merge pull request #8159 from radarhere/qt6

Removed support for Qt 5
This commit is contained in:
Hugo van Kemenade 2024-06-22 22:14:27 -06:00 committed by GitHub
commit 0201707737
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 13 deletions

View File

@ -41,18 +41,13 @@ def test_rgb() -> None:
checkrgb(0, 0, 255) checkrgb(0, 0, 255)
def test_image() -> None: @pytest.mark.parametrize("mode", ("1", "RGB", "RGBA", "L", "P", "I;16"))
modes = ["1", "RGB", "RGBA", "L", "P"] def test_image(mode: str) -> None:
qt_format = ImageQt.QImage.Format if ImageQt.qt_version == "6" else ImageQt.QImage im = hopper(mode)
if hasattr(qt_format, "Format_Grayscale16"): # Qt 5.13+ roundtripped_im = ImageQt.fromqimage(ImageQt.ImageQt(im))
modes.append("I;16") if mode not in ("RGB", "RGBA"):
im = im.convert("RGB")
for mode in modes: assert_image_similar(roundtripped_im, im, 1)
im = hopper(mode)
roundtripped_im = ImageQt.fromqimage(ImageQt.ImageQt(im))
if mode not in ("RGB", "RGBA"):
im = im.convert("RGB")
assert_image_similar(roundtripped_im, im, 1)
def test_closed_file() -> None: def test_closed_file() -> None:

View File

@ -152,7 +152,7 @@ def _toqclass_helper(im):
elif im.mode == "RGBA": elif im.mode == "RGBA":
data = im.tobytes("raw", "BGRA") data = im.tobytes("raw", "BGRA")
format = qt_format.Format_ARGB32 format = qt_format.Format_ARGB32
elif im.mode == "I;16" and hasattr(qt_format, "Format_Grayscale16"): # Qt 5.13+ elif im.mode == "I;16":
im = im.point(lambda i: i * 256) im = im.point(lambda i: i * 256)
format = qt_format.Format_Grayscale16 format = qt_format.Format_Grayscale16