[PyKDE] PyQt and QByteArray

Ingo Krabbe i.krabbe at dokom.net
Mon Oct 21 09:22:01 BST 2002


Hi,

I would like to feed a QPixmap with data read in from a socket.  The
data is ready in a python string, lets call it "data" here.  There is a
QPixmap constructor:

	QPixmap( QByteArray& x )

that loads the pixmap in any accepted format from the memory tagged by
QByteArray (which essentially is a QMemArray<char> template).  Is there
any way to create a QByteArray from my python string ?

It seems that sip cannot handle the template classes or I just don't
know the syntax.


BTW.: This question is a bit universitary, since QPixmap has a member
function QPixmap::loadFromData, which should do the work.  I will try
that one now.  But the for optimization reasons it might be useful to
know how to work with QByteArrays.

BYE INGO




More information about the PyQt mailing list