On Tue, 24 Jun 2008 18:52:46 +0200, "Henning Schröder"
<[EMAIL PROTECTED]> wrote:
> On Mon, Jun 23, 2008 at 9:50 AM, Phil Thompson
> <[EMAIL PROTECTED]> wrote:
>> While QVariant knows how to copy an arbitrary Python object (which is
> just
>> reference count manipulation) it doesn't know how to serialise one.
> BTW, is this reference available anyhow to Python? And could I use
> sip.cast with this reference to convert the QVariant object?
> I totally misunderstood toPyObject and thought that this function
> would do this for me automatically for all types.

No, just for QVariants that wrap objects that can't be converted through
the other ctors.

> This would be needed for writing a generic property editor or if an
> object/widget (-pointer) is stored inside a QVariant.
> 
> Henning
> 
> 
> 
> from PyQt4.QtCore import *
> from PyQt4.QtGui import *
> 
> app = QApplication([])
> win = QLabel("Test", None)
> p = win.property("font")
> assert p.typeName() == "QFont"
> assert p.toPyObject() == NotImplemented

Longer term I'd rather get rid of QVariant entirely, but if you have any
specific suggestions...

Phil

_______________________________________________
PyQt mailing list    [email protected]
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Reply via email to