New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PyQt6 Support #5256
Comments
Hi. ImageQt subclasses QImage, and QImage subclasses QPaintDevice, so I don't see an obvious reason why this shouldn't work. Are you saying that this code worked with PyQt5? |
Hello, Yes, works fine with PyQt5. the problem is that inside ImageQt.py there is a list to know which package contains the class to search for. qt_versions = [
["side6", "PySide6"],
["5", "PyQt5"],
["side2", "PySide2"],
]. As PyQt6 is not defined, it cannot know which package provides each Class a little lower. # 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)
for qt_version, qt_module in qt_versions:
try:
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.QtGui import QImage, QPixmap, qRgba
elif qt_module == "PySide2":
from PySide2.QtCore import QBuffer, QIODevice
from PySide2.QtGui import QImage, QPixmap, qRgba
except (ImportError, RuntimeError):
continue
qt_is_installed = True
break
else:
qt_is_installed = False
qt_version = None Another problem that exists is the regrouping of the Enums, for example: Regards. |
Ah, I misunderstood. I thought you meant something specific to the code you mentioned. I've created #5258 to add support. If you could test it and let us know if it works for you, that could be helpful. |
with the changes ... begin(self, QPaintDevice): argument 1 has unexpected type 'ImageQt'. Original QImage is need for class ImageQt parent, not OpenMode. import OpenMode as QIODevice also gives problems. |
Ok, thanks for checking. I've updated the PR if you wanted to try again. |
the new changes works Ok! . Thanks!! |
Thanks both! Merging, it'll be in the next release at the start of April. |
Hi everyone!. I'm updating my app to PyQt6 and found a problem.
ImageQt.ImageQt class raises an error when try to use with QPainter:
Regards
Python 3.8.6
Ubuntu 20.04
PyQt6 6.0.1
Pillow 8.1.0
The text was updated successfully, but these errors were encountered: