Closed davidlatwe closed 2 years ago
So maybe we should use object instead of "QVariant" to fill up this gap ?
In fact, just found that QtCore.QVariant = object
will not work for string type in QtCore.Property
.
I'm unsure about this. Qt5.py, like Qt.py, should use the PySide2 bindings as target interface. And PySide2 doesn't have QVariant. So, ideally, Qt5.py shouldn't have QVariant either.
If we do add it, then it's not clear what else to add that isn't already in PySide2. :S
Would it be an option for you to stick with "QVariant", as recommended by the PySide2 authors?
Yes, you are right, shouldn't start adding things that wasn't there. And yes, stick with "QVariant" is the best option. ☺️
believe this issue can be closed?
QtCore.QVariant
was missing in PySide, but the document mentioned that one could just use"QVariant"
like:This works for Python built-in types, but looks like not all custom types will be handled properly.
Hit the Emit button and the result will be:
Notice that although the instance of
Thing
stays the same, but the instance ofSheet
has became just alist
.But if you change
"QVariant"
toobject
Then:
They both get preserved.
So maybe we should use
object
instead of"QVariant"
to fill up this gap ? And, anyone knows why it works in this way in PySide ?