[PyQt] PyQt v4.5.2 QVariant woes

Hans-Peter Jansen hpj at urpla.net
Sun Jul 19 17:35:24 BST 2009


Hi Phil,

after updating to 4.5.2, I suffer from a new issue, which is rather basic. 
According to the changelog, you modified QVariant to not accept None 
anymore, but would accept None directly, where a QVariant is expected. This 
is unfortunate, since it breaks my code, but anyway, the second term does 
not apply to QSettings.value() at least:

>>> from PyQt4 import QtCore
>>> settings = QtCore.QSettings()
>>> settings.value("xxx", None)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: argument 2 of QSettings.value() has an invalid type
>>> 

probably due to the const'ness of the 2nd QVariant.

Is there any grave technical reason to not support the QVariant(None) 
anymore? I was so convenient to use a special cased None and and having a 
way to differentiate it with say, empty strings, empty somethings...

Pete


More information about the PyQt mailing list