On Tuesday 12 April 2011, 11:23:33 goocreations wrote:
> I want to store and retrieve a QColor from QSettings. storing is no
> problem:
>
> self.settings.setValue("Color", myColor)
>
> But I can't figure out how to retrieve it again. In C++ you would
> just call .value<QColor>(), but this is not possible in Python.
>
> Any ideas?

Simply wrap the value with a matching c'tor:
    
    QtGui.QColor(value)

Using a reasonably current PyQt, you can provide a type argument:

    QSettings.value("Color", QtGui.QColor)

Pete
_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Reply via email to