mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-26 18:06:18 +03:00
Add support for PySide6
This commit is contained in:
parent
11e63b6a64
commit
4e3dc9a06b
|
@ -14,7 +14,9 @@ def test_rgb():
|
||||||
# typedef QRgb
|
# typedef QRgb
|
||||||
# An ARGB quadruplet on the format #AARRGGBB,
|
# An ARGB quadruplet on the format #AARRGGBB,
|
||||||
# equivalent to an unsigned int.
|
# equivalent to an unsigned int.
|
||||||
if ImageQt.qt_version == "5":
|
if ImageQt.qt_version == "side6":
|
||||||
|
from PySide6.QtGui import qRgb
|
||||||
|
elif ImageQt.qt_version == "5":
|
||||||
from PyQt5.QtGui import qRgb
|
from PyQt5.QtGui import qRgb
|
||||||
elif ImageQt.qt_version == "side2":
|
elif ImageQt.qt_version == "side2":
|
||||||
from PySide2.QtGui import qRgb
|
from PySide2.QtGui import qRgb
|
||||||
|
|
|
@ -7,7 +7,10 @@ from .helper import assert_image_equal, hopper
|
||||||
if ImageQt.qt_is_installed:
|
if ImageQt.qt_is_installed:
|
||||||
from PIL.ImageQt import QPixmap
|
from PIL.ImageQt import QPixmap
|
||||||
|
|
||||||
if ImageQt.qt_version == "5":
|
if ImageQt.qt_version == "side6":
|
||||||
|
from PySide6 import QtGui
|
||||||
|
from PySide6.QtWidgets import QApplication, QHBoxLayout, QLabel, QWidget
|
||||||
|
elif ImageQt.qt_version == "5":
|
||||||
from PyQt5 import QtGui
|
from PyQt5 import QtGui
|
||||||
from PyQt5.QtWidgets import QApplication, QHBoxLayout, QLabel, QWidget
|
from PyQt5.QtWidgets import QApplication, QHBoxLayout, QLabel, QWidget
|
||||||
elif ImageQt.qt_version == "side2":
|
elif ImageQt.qt_version == "side2":
|
||||||
|
|
|
@ -22,13 +22,20 @@ from io import BytesIO
|
||||||
from . import Image
|
from . import Image
|
||||||
from ._util import isPath
|
from ._util import isPath
|
||||||
|
|
||||||
qt_versions = [["5", "PyQt5"], ["side2", "PySide2"]]
|
qt_versions = [
|
||||||
|
["side6", "PySide6"],
|
||||||
|
["5", "PyQt5"],
|
||||||
|
["side2", "PySide2"],
|
||||||
|
]
|
||||||
|
|
||||||
# If a version has already been imported, attempt it first
|
# If a version has already been imported, attempt it first
|
||||||
qt_versions.sort(key=lambda qt_version: qt_version[1] in sys.modules, reverse=True)
|
qt_versions.sort(key=lambda qt_version: qt_version[1] in sys.modules, reverse=True)
|
||||||
for qt_version, qt_module in qt_versions:
|
for qt_version, qt_module in qt_versions:
|
||||||
try:
|
try:
|
||||||
if qt_module == "PyQt5":
|
if qt_module == "PySide6":
|
||||||
|
from PySide6.QtCore import QBuffer, QIODevice
|
||||||
|
from PySide6.QtGui import QImage, QPixmap, qRgba
|
||||||
|
elif qt_module == "PyQt5":
|
||||||
from PyQt5.QtCore import QBuffer, QIODevice
|
from PyQt5.QtCore import QBuffer, QIODevice
|
||||||
from PyQt5.QtGui import QImage, QPixmap, qRgba
|
from PyQt5.QtGui import QImage, QPixmap, qRgba
|
||||||
elif qt_module == "PySide2":
|
elif qt_module == "PySide2":
|
||||||
|
|
Loading…
Reference in New Issue
Block a user