[PyQt] Problem Loading Default QSetting

Brent Villalobos Brent.Villalobos at pdi.dreamworks.com
Mon Jan 5 18:47:25 GMT 2009


If I understand the documentation correctly, the 
QtCore.QSettings.value() method's second argument can be a QVariant 
default value.  However, when I provide a key that does not exist, I'm 
not defaulting to that value.  Observe when I try to read the settings 
for a configuration that does not exist:
 >>> from PyQt4 import QtCore
 >>> settings = QtCore.QSettings('MyComp', 'NoConfig')
 >>> settings.beginGroup('NoExist')
 >>> print settings.value("pos", QtCore.QVariant(100, 100)).toSize()
PyQt4.QtCore.QSize(-1, -1)

Why am I receiving a QSize(-1, -1) object instead of QSize(100, 100)?


More information about the PyQt mailing list