Sophie

Sophie

distrib > Mageia > 4 > i586 > by-pkgid > 28b9e36e96ce34b2567ae5b47a27b2c5 > files > 20

python-qt4-doc-4.10.3-3.mga4.noarch.rpm

Python Objects and QVariant
===========================

Qt uses the ``QVariant`` class as a wrapper for any C++ data type.  PyQt4
allows any Python object to be wrapped as a ``QVariant`` and passed around Qt's
meta-object system like any other type.

PyQt4 will try to convert the Python object to a C++ equivalent if it can so
that the ``QVariant`` can be passed to other C++ code that doesn't know what a
Python object is.

Version 2 of PyQt4's ``QVariant`` API will automatically convert a ``QVariant``
back to a Python object of the correct type.

Version 1 of the ``QVariant`` API provides the ``QVariant.toPyObject()`` method
to convert the ``QVariant`` back to a Python object of the correct type.

Both versions will raise a Python exception if the conversion cannot be done.