[PyKDE] PyObject <-> QVariant, designer progress
Roland Schulz
mail at r2s2.de
Wed Nov 5 20:43:01 GMT 2003
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hey,
is there a function to convert a PyObject from/to a QVariant?
Of course this can be done like:
For convert to PyObject (as tuple)
case 0:
args = Py_BuildValue ("(i)",v->asInt());
break;
case 3:
args = Py_BuildValue ("(s)",v->asString().latin1());
break;
For convert to QVariant
case 0:
*v = QVariant((int)PyInt_AsLong(ret));
break;
case 3:
int isErr = 0;
*v = QVariant(*sipForceConvertTo_QString(ret, &isErr));
if (isErr) { printf ("***failed sip conversion to C++ pointer\n"); return
FALSE; }
break;
But I hope somebody has done it, because I think it's quite a lot of work.
regards
Roland
PS: Properties are (almost) working for Python Plugins in designer. The only
problems left are that only enums and strings work as datatypes (see
above ;-)) and that error handling is missing.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2-rc1-SuSE (GNU/Linux)
iD8DBQE/qVJ4V/hlvQgMogsRAnCxAJwJKIEP9zrJy6+4OHnv7j0wu4UrxACg25rl
GO2qgcOE/hLCYRHLu25YIk0=
=24m8
-----END PGP SIGNATURE-----
More information about the PyQt
mailing list