[PyQt] QSettings with QColor in PyQt

Goo Creations goocreations at gmail.com
Tue Apr 12 13:18:52 BST 2011


cool, thank you.

On Tue, Apr 12, 2011 at 1:24 PM, Hans-Peter Jansen <hpj at urpla.net> wrote:

> 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 at riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20110412/cf3dd80a/attachment.html>


More information about the PyQt mailing list