QImage to QPixmap Convertion Parameter Error after QT 6.2 Update at Python
-
Python Version: 3.7
OS: Windows 10
QT Version: 6.2I was using "QPixmap(qt_image)" to convert from QImage to QPixmap at QT5. After getting updates of QT6, I get error as below;
TypeError: QPixmap(): argument 1 has unexpected type 'QImage'
So changed usage of typecasting as QPixmap.fromImage(qt_image) and now getting this;
TypeError: fromImage(QImage, flags: Qt.ImageConversionFlag = Qt.AutoColor): argument 1 has unexpected type 'QImage'
There are some reference links that I used to get information about QT6 QPixmap;
-
Hi and welcome to devnet,
Do you have the same issue with fromImageInPlace ?
-
Hello and thanks, That is right.
QPixmap.fromImageInPlace(qt_image) AttributeError: type object 'QPixmap' has no attribute 'fromImageInPlace'
I also converted all imports from qt6 to qt5 and there is no issue with typecasting using QPixmap(QImage).
But I should inform you, my QT APIs are PyQT, not PySide.
-
Would you mind checking with PySide6 ?
From the looks of it, there's something wrong going on with PyQt.
-
@msaidbilgehan I just tested:
qimage = QImage("/path/of/filaname")
pixmap = QPixmap(qimage)
on PySide6 and PyQt6 (the latest versions available) and it works fine. Could you provide a code that allows me to verify the error? -
@eyllanesc I am sorry but right now I can't. Downgraded from 6 to 5. I will wait for the best stable version of QT. Thanks a lot!
P.S.: I was using fromImage method which is necessary for my app flow. Not type conversion with the class call (such as QImage() )