[PyQt] Problem Loading Default QSetting
Lukas
LuHe at gmx.at
Mon Jan 5 19:02:09 GMT 2009
Hello,
Am Montag 05 Januar 2009 19:47:25 schrieb Brent Villalobos:
> 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()
you want to store a QSize in the QVariant, so you have to write:
>>> print settings.value("pos", QtCore.QVariant(QtCore.QSize(100,
100))).toSize()
PyQt4.QtCore.QSize(100, 100)
>
> PyQt4.QtCore.QSize(-1, -1)
>
> Why am I receiving a QSize(-1, -1) object instead of QSize(100, 100)?
> _______________________________________________
> PyQt mailing list PyQt at riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt
More information about the PyQt
mailing list