[PyKDE] QVariant support in PyQt4

Andreas Pakulat apaku at gmx.de
Thu Jan 5 00:24:06 GMT 2006

On 03.01.06 23:54:47, Phil Thompson wrote:
> On Friday 30 December 2005 8:36 pm, Andreas Pakulat wrote:
> > Hi,
> >
> > maybe I'm just too stupid, but it seems the following C++ code:
> >
> > qVariantFromValue(QColor(Qt::blue)
> >
> > cannot be correctly ported to PyQt4. Using
> >
> > QtCore.qVariantFromValue(QtCore.QVariant(QtGui.QColor(QtCore.Qt.blue)))
> I've removed qVariantFromValue().
> > I get a QVariant which type() function returns type number 66 (which
> > would be QBrush, not QColor).
> QVariant(QColor(Qt.blue)) will work in tonight's snapshot.

After that's fixed querymodel should be working (except that there are 2
prints around line 48) and it allowed me to work a bit more on the
puzzle itemview example. But I'm stuck at the point where I have to get 
a QPixmap instance out of a QVariant. There is no value() method for
QVariant available and I haven't found another way to do the conversion.

>From dir(QtCore.QVariant) I see a load, save and data method but at
least the data method didn't do what I wanted...


You will have good luck and overcome many hardships.

More information about the PyQt mailing list