I am using from qtswitch import QtGui, QtCore
instead of the usual from PyQt4 import QtGui, QtCore
, and there are some parts in which I am having trouble.
One of them is the error where in one of my function, I had it return QtCore.QVariant()
and I keep getting the following error
AttributeError: 'module' object has no attribute 'QVariant'
and the opening sentence of the function is as follows:
def input(self, index, role=QtCore.Qt.DisplayRole):
Any ideas? Or perhaps are there more documentations that I can read up on it?
Check your PySide version as PySide no longer supports QVariant. As found: here.
Please note on Python 3 or using sip.setapi('QVariant', 2)
with PyQt4 you would get this error using return QVariant()
:
TypeError: PyQt4.QtCore.QVariant represents a mapped type and cannot be instantiated
I would suggest moving away from using QVariant in this way.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With